Javascript code for validating radio buttons

27-Feb-2018 21:03

I just can't see a way to even begin this to be honest.

I am attempting to validate radio buttons in Netscape with Java Script.

Here is the code used for the radio button themselves.

The creation of multiple groups of radio buttons for the one form is also straightforward.

In actual fact the setup of these fields is the most simple of all form fields to validate as radio buttons set one value that only needs to be tested when the form is submitted.

The difficulty with radio buttons is that there are at least two and usually more fields that need to be placed on the form, related together and tested as one group.

The name field determines which group that a particular button belongs to.Everything works excellent in Explorer, but refuses to work in Netscape (all versions).=========== JAVASCRIPT CODE ======================== function Validate Test() =========== HTML FORM CODE ========================= ================================================== == The Java Script error that I receive is the following: "TEST is not defined." ================================================== == TEST is the name of my form.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 solution here is to give all of the radio buttons within the group the same name but different values.

The name field determines which group that a particular button belongs to.Everything works excellent in Explorer, but refuses to work in Netscape (all versions).=========== JAVASCRIPT CODE ======================== function Validate Test() =========== HTML FORM CODE ========================= ================================================== == The Java Script error that I receive is the following: "TEST is not defined." ================================================== == TEST is the name of my form.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 solution here is to give all of the radio buttons within the group the same name but different values.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.