PhotoMan2000
asked on
validate checkboxes and radio buttons
I have 2 groups of check boxes and 2 groups of radio boxes that need to be validate for being selected / checkes.
For the checkoxes, the user must pic at least one box on each group. name
For the radio buttons, the user must select one radio button.
Each checkboxes and radio buttons are grouped by matching names.
I do NOT want an alert to fire but make use of the .error that gets attach when I'm using this style code:
For the checkoxes, the user must pic at least one box on each group. name
For the radio buttons, the user must select one radio button.
Each checkboxes and radio buttons are grouped by matching names.
I do NOT want an alert to fire but make use of the .error that gets attach when I'm using this style code:
$("#FORMNAME").validate(
rules {
fieldname: "required"
},
messages{
fieldname: "This is Required"
}
ASKER
I apologize.. I want to use JQUERY for the solution. (If not buttons or boxes are check to add the message next to the element group that is invalid.
This demo uses JQuery: http://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo.html
ASKER
Yep, saw that.. can't seem to figure it out, which is why I'm asking for help in EE.
ASKER
Sorry, that's not working for me. In my original code snippet that method, inserts a div element with a class of "error" at each item that is in the rules list using the Message values.
The sample that you provided, (which I had seen before but gave another chance) has a label called "error" already part of the code. So when I first load the page the error message is present BEFORE submitting the form to be validated
Also I'm using coldfusion so an attribute in the input tag of validate="required:true" throws an error as it's not correct for coldfusion.
Please advise..
The sample that you provided, (which I had seen before but gave another chance) has a label called "error" already part of the code. So when I first load the page the error message is present BEFORE submitting the form to be validated
Also I'm using coldfusion so an attribute in the input tag of validate="required:true" throws an error as it's not correct for coldfusion.
Please advise..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.randomsnippets.com/2008/05/15/how-to-loop-through-checkboxes-or-radio-button-groups-via-javascript/