0

Hi all,

I am making a form in which i am using two radio button.Now i want that if i click on first radio button and after that i will click on submit button then page should go different page .
If i click on 2nd radio button and after that i submit page then page should go on different page.

Please help me to solve this. How i can do this if it is possible.
thanks

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Airshow
0

What you could do, is on the submit function of your button, check which radio button was selected, then change the value of the form action attribute.
for the changing of the value of the form action:

document.formName.action ="whever u want it to go"

formName is the name of your form.

0

Gagan22,

<script>
function setAction(r, url){
	r.form.action = url;
	r.blur();
}
</script>
<form name="myForm" action="myPage_1.html" method="post">
	<input type="radio" id="a1" name="a" onclick="setAction(this, 'myPage_1.html')" checked="checked"><label for="a1">Page 1</label><br>
	<input type="radio" id="a2" name="a" onclick="setAction(this, 'myPage_2.html')"><label for="a2">Page 2</label><br>
	<!-- rest of your form ...... -->
</form>

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.