A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Problems with checkbox using Struts Validation
Joined: Feb 16, 2005
Feb 16, 2005 03:10:00
Hi everybody, I have two problems with my
1) I want my DynaValidator to validate the input:text only if it is not empty and the checkbox is not checked, but I can't find the right expression for the "validwhen" property. Actually it is:
<field property="text_name" depends="validwhen">
<arg0 key="myform.mytext_name" />
<var-value>((checkbox_name == null) and (*this* != null))</var-value>
but i don't know how to validate the ""
2) when validation fails, the validator calls back the page. The checkbox will still be checked, but the input:text will not be disabled.
Could you help me? Thanks in advance. David
Joined: Feb 05, 2003
Feb 16, 2005 08:09:00
null will also check for empty string ("")
See the bullet item for null.
"* The value null which will match against either null or an empty string "
[ February 16, 2005: Message edited by: Marc Peabody ]
A good workman is known by his tools.
It is sorta covered in the
JavaRanch Style Guide
subject: Problems with checkbox using Struts Validation
validwhen not work, even validate double not work
Validator validwhen question
Validator Checkbox validwhen
how to design this JSP. need ur suggestion
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015