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

select and radio button validation

Status
Not open for further replies.

bamboo

Programmer
Aug 22, 2001
89
US
I have a simple form with text inputs, drop-downs and radio buttons. I have all the validation working properly except for a drop-down and radio button. When a user selects a particular option from the drop-down I want a radio button to be checked on the next step. I can do this when the user submits the form, but I'd like the function to run on the fly as the form is quite lengthy. I'm not sure what the proper event would be for the form select statement? Any help would be great.
 
You best bet would be putting you function on the onChange event.
Code:
onChange="myfunction();"
Is this what you were looking for?
 
Ya I got my test function to run by popping up an alert. However I'm still trying to figure out how to make a radio button checked. Here is a sample of my js function:

if(document.myform.selectedIndex == 2 && document.myform.theradio[0].checked)
{
document.myform.theradio[1].checked;
return true
}

So basically if the user selects the 2nd option and the yes[0] radio button is checked, it will uncheck it and check the no[1] radio.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top