Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does anyone have any pre-built tags to validate contact info fields (e.g. phone, email, state ...)

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using MyFaces 1.1.9. Can anyone point me to or share sample code that you have that creates a JSF text field for a US phone number and an email address that also validates those fields are of the right form (in the case of the phone number, I'm looking for the format "XXX-XXX-XXXX")?

Thanks, - Dave
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out some of the extensions tagsets like MyFaces Tomahawk and RichFaces.

Another alternative is the MyFaces Extensions Validator, which allows you to define validations in the backing bean or on the datamodel. The datamodel option has the advantage of enforcing validation going to the database regardless of where the data came from, UI or not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic