Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form "action=" variable?

Status
Not open for further replies.

westcoaststyle

Programmer
Oct 15, 2001
81
US
Is it possible to have 2 submit buttons, one of which goes to one preset page with the form variables and the other goes to another page with those variables?

For example: I have a form with a drop box. Once I select that value from the drop box I can select one button to display it on one page in XML or I can select the other button and display the value in HTML.

I already know how to display the data in both of these "languages" but I don't know how to get it to go to the individual pages with the drop box variable.

Thanks!!
 
something like this should do the job:

function checkaction(formobj,flag){
if (flag){
formobj.action="path.to/scriptOne.cgi";
}else{
formobj.action="path.to/scriptTwo.cgi";
}
formobj.submit();
}

<form name=forma .. >
..
<input type=button value=&quot; XML &quot; onclick=&quot;checkaction(this.form,0)&quot;>
<input type=button value=&quot; HTML &quot; onclick=&quot;checkaction(this.form,1)&quot;>
</form>
Victor
 
I found another thread that does basically what you just said - located here: thread215-86565 (just above this thread on the thread list)

Please read that post and reply to what I wrote there. I'll try what you have written, but what do I put for the action of the form? <form name=... action=&quot;?&quot;>

Thanks!!
 
You need not enter anything in the action attribute as it is not mandatory. Alcohol and Calculus never mix! Do not drink and derive!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top