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

Validating Radio Buttons

Status
Not open for further replies.

jmorris

Programmer
May 2, 2000
15
AU
I am wanting to validate a that a radio button has been selected, can I just use the same sort of javascript as validating that a text field has a value? (I tried this and couldn't get it working). Can anyone suggest some javascript to validate a radio button from a set has been selected.

Regards

Jason Morris
 
A code like this works for validating a radio button:


if (!(mainform.Sex[0].checked || mainform.Sex[1].checked)) {
alert('Your sex is a required field. Please try again.');
event.returnValue=false;
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top