File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Murach's Java Servlets and JSP
this week in the
Validation on multiple checkboxes using Struts validator
Joined: Jul 01, 2003
Aug 12, 2005 02:56:00
I am using Struts validator framework for validations on my page.
On one page, I have multiple checkboxes (no. is not fixed). They are generated runtime depending on the no.of records. On click of submit, I need to make sure that, all checkboxes are checked.
If i set that field as "required", its of no use, because even if i'm checkin a single check box among the list, the condition will be true and it will not validate for rest check boxes.
can anyone help me in solving this problem?
Joined: Aug 09, 2005
Aug 12, 2005 04:53:00
I think you can use
Let me know if it helps
document.FORMNAME.checkboxes[i].checked = chk.checked;
Joined: Dec 27, 2001
Aug 12, 2005 08:36:00
If you are using Validation framework, you can do this in validation.xml using indexedListProperty="collection". I assume you have a checkboxes as "collection"
Joined: Jul 01, 2003
Aug 15, 2005 22:44:00
Thanx for the reply.
I tried indexedListProperty="collection". But it is not serving my purpose.
My problem is:-
I have a list of records, generated dynamically. So the no.of checkboxes are not fixed. On click of 'submit', I want to make sure that all checkboxes are checked.
I get error if I haven't checked any of the checkboxes but if one checkbox is checked, it is saying 'No validation error'
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Validation on multiple checkboxes using Struts validator
ActionForm Does Not Pick Up the Values of the Selected Check Boxes
How to check 2 fields are equal or not
Check atleast one checkbox is selected
Struts Form Beans & Multicheckboxes
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014