• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to validate date type parameter with validator

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in the validation.xml::::
I use :<field property="baoMing.birth"
depends="date">
<arg0 key="prompt.birth"/>
</field>
but it doesn't work..while others ,such as 'depends="required" 'works well
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Struts Validator Guide shows how to validate dates:

or


Of course, you could also use a regular expression through the built-in mask validation:
 
charlse li
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
must we use depends="required,date"?can't we use depends="date"??
howerver,,,neither works well..
did try it successfully?
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you don't need to use 'required'.

I didn't try it myself -- that snippet is directly from the documentation. What kind of an error are you getting?
 
charlse li
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no error is retrieved ,but validation doesn't work,just as it doesn't exist.
i don't know where the problem lies.
you are very kind ,thank you very much.
 
charlse li
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,Lasse Koskela
when i validate the
<html:radio property="result_type" value="result_Test"/>
<html:radio property="result_type" value="result_HKW"/>
my validation.xml as follows:
<form name="ResultTypeForm">
<field property="result_type"
depends="required">
<arg0 key="prompt.result_type"/>
</field>
</form>

it doesn't work either. will you give some advice?thank you.
reply
    Bookmark Topic Watch Topic
  • New Topic