Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes struts checkbox validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts checkbox validation" Watch "struts checkbox validation" New topic

struts checkbox validation

K Amin

Joined: Oct 11, 2007
Posts: 8
Can anybody help me with this kind of valadition which has a checkbox and 2 password input fields, if the checkbox is checked then password filds are required otherwise not. For other forms in this application I am using client-side validation.

Thanks in advance
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
Use "validwhen".
K Amin

Joined: Oct 11, 2007
Posts: 8
Thanks Lassy,

I have been trying to use "validwhen" but I couldn't get it work. I am sending you the code, if you can help me what to write in validation.xml that will be great

<td><bean:message key="label.changepassword"/></td>
<td><html:checkbox property="changePassword" /></td>
<td><bean:message key="label.password"/></td> </td>
<td><html assword property="password" /></td>
<td><bean:message key="label.passwordagain"/></td>
<td><html assword property="passwordagain" /></td>

I agree. Here's the link:
subject: struts checkbox validation
Similar Threads
JSF validations using validator method?
Struts two filed comparison
How to make text fields appear when checkbox is selected
problem in name and password fields validation
Check Box