• 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

Date Formatting Problem with Validator

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have an entry in my validation.xml file for a form where I'm trying to make sure the user can't enter a date like "01/01/20234".

However, what I entered below does not work so I must be doing something wrong?

<field property="fDate" depends="date">
<arg0 key="label.fDate"/>
<var><var-name>datePattern</var-name><var-value>MM/dd/yyyy</var-value></var>
</field>

I don't want to use datePatternStrict since the user may forget to add two digit months and years.

Although, the date validator does seem to validate some date entry issues, it fails when I enter more than 4 digits for the year, which then crashes the application due to a date transformation for an Oracle Query.

Any suggestions would be welcome!

Thanks.

Mike
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its strange issue when you enter more than four digits for the year and its get validated(May be I'm missing something very basic).
Try using "MM/dd/yy" pattern and also look at the java.text.SimpleDateFormat class summary.
 
Nothing? Or something? Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic