wood burning stoves 2.0*
The moose likes Struts and the fly likes to validate multibox  in a jsp with struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "to validate multibox  in a jsp with struts" Watch "to validate multibox  in a jsp with struts" New topic
Author

to validate multibox in a jsp with struts

pavani potnuru
Greenhorn

Joined: Nov 04, 2007
Posts: 11
Hi,
I am using multibox in a jsp page. I have to validate such a way that if any user does not click any box, it should display an error message saying that atleast one checkbox have to be selected.I am working on struts, so i would like to know if there are any autovalidation or in any other way....
Thanks in advance
pav
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you're defining this property in a DynaActionForm, specify initial="{}" when you define it in the struts-config.xml file. If you're writing your own ActionForm, overrride the reset(...) method and specify somewhere in that method. Once you've done this, you can simply use the standard "required" validation for this property.

The reason you need to initialize it as an empty String array is that if no checkbox is checked, nothing will get set to the server, and the validation framework doesn't recognize it.
[ November 25, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to validate multibox in a jsp with struts
 
Similar Threads
multibox - nullPointerException
to validate multibox in a jsp with struts
struts and multibox
Iterator and multibox
multibox , resultSet, logic:iterate