Validating radiobutton svn error validating location
In order for the person filling out the form to understand what each radio button in our group does, we need to provide descriptions for each button.To associate the text with its corresponding radio button so that clicking on the text will select that button, we need to make a further addition to the code for each button by surrounding the entire button and its associated text within a label.The first thing that to look at when using radio buttons on our form is how the buttons need to be coded in order for them to function properly as radio buttons.The desired behavior we want is to have only one button selected at a time; when one button is selected then any previously selected button will be automatically deselected.
The final step is to set up the radio button validation using Java Script.
Validating Radio Button Groups By setting the value of the variable, "found_it" equal to the checked button's value, the original button loop script can easily find which button was checked. We need a way to handle this situation, especially if you want to require a button from a group be checked.
Before getting into the additional validation scripting, I want you to notice something about the found_it variable in the original script - it is declared but not initialized. Because it was not assigned a value initially, it has an original value of null, and will stay that way unless its value is reset to a checked button's value. Logical operators test two boolean values for equality.
All of the radio button groups that you will ever need can be handled using the steps covered above.
For each pair of radio button you have (or for each set, being it pairs for yes/no questions).
In this example, we alert the user to please check a radio button.