• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

validate convertDateTime

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I have this code:
<h:inputText id="data" value="#{uBean.data1}">
<f:convertDateTime pattern="dd-MM-yyyy" dateStyle="full"/>
</h:inputText>
Why if I write in "input text" one day wrong or one month wrong, validation generates a format error and if I write one year wrong, validation doesn't shows validation error?

If I write 12-13-1989 shows format error.
If I write 12-12-198 doesn't shows format error.

How do I do to generate error also for year?

Thanks
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems everything is right. After all, year 198 is valid. I don't remember what happened then, but it certainly is part of planet Earth's history. On the other hand, month 13 does not exist in our gregorian calendar. You see, the problem is not about the correctness of the date itself, but the correctness of its meaning. So you need validation for that date, perhaps by implementing a javax.faces.validator.Validator; at least that is my suggestion. Good luck
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Henrique Sousa:
It seems everything is right. After all, year 198 is valid. I don't remember what happened then, but it certainly is part of planet Earth's history.



I rememeber what happened. Everyone started freaking out about the year 200 and the fact that none of their scrolls were compliant. It was chaos. Goats were slaughtered and stored in shelters along with mass amounts of water in case the world ended.
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remember "Party like it's 199"?

 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic