Forum Moderators: open
My form allready has the submit button but I want to press it when the user clicks one o the two options. Does someone know how to accomplish this?
Regards
First of all, Welcome to Webmaster World!
As for your question, you can add a handler to the select's onchange event, which fires when the user changes the value of the option and submits the form. You should start with a 'please choose' option so that the user will have to change the option and fire the event. See below:
<form method="post" action="blank.htm">
<select onchange="document.forms[0].submit()">
<option value="">Please Choose</option>
<option value="yes">Yes</option>
<option value="no">No</option></select>
</form>
hope this helps,
ajkimoto
You can use the onclick event to house the event handler for radio buttons. So you might have something like this:
<form method="post" action="blank.htm">
<input type="radio name="rad1" value="yes" onclick="document.forms[0].submit()" />
<input type="radio name="rad1" value="no" onclick="document.forms[0].submit()" />
</form>
ajkimoto