• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problems with checkbox using Struts Validation

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody, I have two problems with my Struts application. I have a checkbox that disables an input:text when checked (I use a simple javascript to do that). My problems are:

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>
<var-name>test</var-name>
<var-value>((checkbox_name == null) and (*this* != null))</var-value>
</var>
</field>


but i don't know how to validate the "" string.

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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic