If you have N sets of radios, you can use a for loop to go through all radio sets.My solution for validation complex forms include radios.

my_form[key]||my_form[key]==null||err){ break; } //console.log(my_form[key].name); var x = my_form[key].value; //console.log(x); if(my_form[key]== "radio"){ //console.log("radio"); if(radio_arr[my_form[key].name] !

I've combed a ton of the pages on here, and still am incapable to get my explicit validator to work.

Basically, when the submit button is clicked, I want the script to verify a radio is checked, if one is checked to do nothing.

Here is a fuller example: View Demo This can probably be refactored so comments welcomed to refine the idea.

I would like your help to develop a javascript function to validate if one of the following radiobutton group (IDType) is selected and which value is checked and view error message in (Validation Error) division in case no radio button selected ??

function validate Radio Buttons(){ var radio = $('input:radio[name="IDType"]:checked'); if(radio.length == 0)//no buttons selected { $('Validation Error').text("you haven't selected any buttons!Then you can add another call to validate Radio() passing the corresponding radio set (document.forms["survey1"]["q2"]).This is great but comes with the inevitable HTML5 caveats that it just can't be relied on across all browsers. So in order to get this two arrays are created to store all the names and then refine that list of the unique names.So for true radio button validation we need a Javascript solution .... Firstly lets add some HTML to provide error messages. Looping around the variable is used to keep count of things.So if the number of non-completions is greater than zero the form isn't submitted.This may seem over engineered but it is designed so that multiple radio button groups can be validated.