faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

174 of 207 people (84%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Can I submit a form using onchange from a radio button?

Jan 21st, 2001 05:30
Luiz Paulo Rosa, Nick Ashton,


The radio button object doesn't support the onChange event (at least 
the Netscape documentation doesn't mention it), but you can use the 
onClick event in each element of the radio button array.
Use the following code as an example:
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD=POST name="MyForm" action="process.asp">
1<INPUT TYPE="radio" NAME="rdo" onClick="document.MyForm.submit()"><BR>
2<INPUT TYPE="radio" NAME="rdo" onClick="document.MyForm.submit()"><BR>
3<INPUT TYPE="radio" NAME="rdo" onClick="document.MyForm.submit()"><BR>
4<INPUT TYPE="radio" NAME="rdo" onClick="document.MyForm.submit()"><BR>
</FORM>
</BODY>
</HTML>
I hope this can be useful.