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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form action based on radiobutton selected

Status
Not open for further replies.

camillaj

Programmer
Sep 18, 2003
31
0
0
AU
Hi, I'm trying to perform a simple action after the user has selected a radiobutton, and will then redirect the user to page1.asp if button1 is checked or page2.asp if button2 is checked. How can I make this selection?

<form name=&quot;form1&quot; id=&quot;form1&quot; method=&quot;post&quot; action = &quot;?&quot; target=&quot;_blank&quot;>

<input type=&quot;radio&quot; name=&quot;type&quot; value=&quot;results&quot; />
<input type=&quot;radio&quot; name=&quot;type&quot; value=&quot;edit&quot; />
<input type=&quot;Submit&quot; name=&quot;Get&quot; value=&quot;Get&quot;>
</form>

I tried to insert a script after &quot;action&quot; that checks the radiobuttonvalue, but obviously the values get posted straight away to the action page.

Can somebody please help me on this :()
 
you mean something like this: changing the action url from the radio button checked

<script>
function ChangeFormAction(vUrl){
document.getElementById(&quot;form1&quot;).action=vUrl;
}
</script>

<form name=&quot;form1&quot; id=&quot;form1&quot; method=&quot;post&quot; action = &quot;new&quot;>
<input type=&quot;radio&quot; name=&quot;type&quot; value=&quot;results.asp&quot; onclick=&quot;ChangeFormAction('results.asp')&quot; />Results<br>
<input type=&quot;radio&quot; name=&quot;type&quot; value=&quot;edit.asp&quot; onclick=&quot;ChangeFormAction('edit.asp')&quot; />Edit<br>
<input type=&quot;Submit&quot; name=&quot;Get&quot; value=&quot;Get&quot;>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top