Here's a code snippet. . .
<form name="FinalAccept" method="get"><br>
<input type="radio" name="YesNo" value="Yes" onclick="/accept"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="/accept"> No<br>
Clearly, what I'm trying to do is call the routine linked to /accept when the user clicks on the radio button.
I know the routine is working because I call the same routine from another place in the program.
I'm trying to run it locally using google appserver. Is there something I'm missing?
Thanks
You're probably thinking of action= for the form element. onClick would just fire a javascript function.
If you want to submit the entire form when the user clicks on a radio button, then try this:
<form name="FinalAccept" method="get" action="accept"><br>
<input type="radio" name="YesNo" value="Yes" onclick="this.form.submit();"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="this.form.submit();"> No<br>
</form>
Plus, if you want to make your UI a little more user friendly, change it to this:
<form name="FinalAccept" method="get" action="accept"><br>
<input id="rYes" type="radio" name="YesNo" value="Yes" onclick="this.form.submit();">
<label for="rYes">Yes</label><br>
<input id="rNo" type="radio" name="YesNo" value="No" onclick="this.form.submit();">
<label for="rNo">No</label><br>
</form>
This will make the text "Yes" and "No" as clickable labels for their radio buttons. The user can click the label to select the radio button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With