nawaf
asked on
Can Javascript make activate/inactive button?
I have 2 buttons, one should be pressed before the second. The second button should process the result from the first one. Can I make the second one inactive until the first button pressed and then activate it. Or is there a solution to this problem. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK, I am unsure what the generate button is supposed to do. Is it performing some calculation on the input fields, or is it supposed to call a cgi program? And either way, it should be possible with only one button.
If generate is just calling a cgi program, you should be able to make the cgi program return the results to the page for you (it creates a new page).
If you're using javascript to make the calculations, then you can simply use one button and when it's clicked perform the calculations and then continue with the displaying of the data either via CGI or via javascript to a new window or something.
-Josh
If generate is just calling a cgi program, you should be able to make the cgi program return the results to the page for you (it creates a new page).
If you're using javascript to make the calculations, then you can simply use one button and when it's clicked perform the calculations and then continue with the displaying of the data either via CGI or via javascript to a new window or something.
-Josh
ASKER
The generate button run a cgi program that generate an image. Once the image is produced by an external program, the display button should display it. I know that we can't put 2 submit button but do you have a solution. Thanks
OK, this is somewhat more complicated, but here comes some brainstorming:
Basically the only way for the cgi program to communicate with your web page is to have it return directly to your page it's results (you could use a hidden frame), or you could write the results to a pre-known file on the server and then access that file from the display button. The second easier method would work ok in this situation as long as you didn't expect two people to be performing this operation at the same time (which is highly unlikely). SO, you will probably need to communicate with a hidden frame. This can get kind of complex. Also it will probably be easier if you are able to create a new file and put your generated image into that file on your server. Then send to the hidden frame a web page which includes that image. Then when the user clicks on display it shows the image however it is that you want it shown.
I just thought of another method that would be simpler if you wouldn't mind a new window popping up to show the image. Simply using one button, you can target the form to "_blank" causing it to display into a new browser window, and simply return the image in image format directly to that window. Then when the user is done looking at it, they just close the window.
My only other question is if you know how to do this cgi image generating, because truthfully I don't know how (although I'm interested to learn if I ever get the time).
Well, tell me what you think about the different methods I mentioned in my brainstorming and what would be feasable.
-Josh
Basically the only way for the cgi program to communicate with your web page is to have it return directly to your page it's results (you could use a hidden frame), or you could write the results to a pre-known file on the server and then access that file from the display button. The second easier method would work ok in this situation as long as you didn't expect two people to be performing this operation at the same time (which is highly unlikely). SO, you will probably need to communicate with a hidden frame. This can get kind of complex. Also it will probably be easier if you are able to create a new file and put your generated image into that file on your server. Then send to the hidden frame a web page which includes that image. Then when the user clicks on display it shows the image however it is that you want it shown.
I just thought of another method that would be simpler if you wouldn't mind a new window popping up to show the image. Simply using one button, you can target the form to "_blank" causing it to display into a new browser window, and simply return the image in image format directly to that window. Then when the user is done looking at it, they just close the window.
My only other question is if you know how to do this cgi image generating, because truthfully I don't know how (although I'm interested to learn if I ever get the time).
Well, tell me what you think about the different methods I mentioned in my brainstorming and what would be feasable.
-Josh
ASKER
can you give a simple example please. Thanks
A simple example of which method?
What will the cgi program be doing? Do you have control over the output of the cgi program?
I can make a short example with one of these methods, but it will just be calling a counter program which I wrote (and produces the new image each time).
I don't want to do examples of all of the methods I described, since I don't have the time, but if you pick one I can do it.
-Josh
What will the cgi program be doing? Do you have control over the output of the cgi program?
I can make a short example with one of these methods, but it will just be calling a counter program which I wrote (and produces the new image each time).
I don't want to do examples of all of the methods I described, since I don't have the time, but if you pick one I can do it.
-Josh
ASKER
Yes I understand that you can't give an examples of all possible methods but I need a solution to try not words. Can you code my posted example ( as you proposed earlier)so I can grade you and finish this . I don't like keeping the evaluation open for so long. Thanks
ASKER
<HTML>
<HEAD>
<TITLE>slope</TITLE>
</HEAD>
<BODY BGCOLOR="#99ccff">
<FORM method=post ACTION="http://server/cgi-bin/slope.pl" >
<table cellpadding=0 cellspacing=0 border=0 width=750 bgcolor="#6666ff">
<tr><td>
<font face="GillSans, Ventana, Arial, Helv" size=4 align=center>Slop/Aspect finctions</font>
</tr></td>
<tr><td colspan=2> </td></tr>
<tr><td>
<font face="GillSans, Ventana, Arial, Helv">
<I>Input File </I>
</font>
<SELECT NAME="inputs">
<OPTION value="affaosol">affaosol
<OPTION value="brazil2">brazil2
<OPTION value="brazil4">brazil4
<OPTION value="nrain">nrain
<OPTION value="water">water
<OPTION value="relief">relief
<OPTION value="prwater">prwater
<OPTION value="massland">massland
</SELECT>
</tr></td>
<tr><td colspan=2> </td></tr>
<tr><td>
<font face="GillSans, Ventana, Arial, Helv">
<I>Output File</I>
</font>
<INPUT TYPE="text" NAME="outputs" SIZE="10" MAXLENGTH="10">
</tr></td>
<tr><td colspan=2> </td></tr>
<tr><td>
<font face="GillSans, Ventana, Arial, Helv">
<I>functions:</I>
</font>
<INPUT NAME="slas" TYPE="radio" VALUE="slope" CHECKED> Slope
<INPUT NAME="slas" TYPE="radio" VALUE="aspect">Aspect
</font>
</tr></td>
<tr><td colspan=2> </td></tr>
<tr><td>
<!--- button 1 ----->
<input type="submit" value="Generate">
</tr></td>
<tr><td>
<!--- button 2----->
<input type="submit" value="Display">
</tr></td>
</table>
</form>
<dir>
<A HREF="javascript:history.b
</dir>
</BODY>
</HTML>