Basically, when the submit button is clicked, I want the script to verify a radio is checked, if one is checked to do nothing.
If one isn't checked I want it to post an alert message.
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.
It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.
For an alternative approach to client-side form validation, without Java Script, check out our new article on HTML5 Form Validation which is available now in most modern browsers.
Would you like to answer one of these unanswered questions instead?
I've combed a ton of the pages on here, and still am incapable to get my explicit validator to work.
when submit button is pressed and no radio buttons have been selected, it alerts the user saying 'please select a check box', and if a radio button has been selected then simply submit the form, needs no alert.roughly my html looks like: Thank you for your interest in this question.Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).Given a reference, form, you could check the group with either of the following expressions.What follows is my original description of how to validate radio buttons written back in 2001.