• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JSF validation

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to validate a field for a regex and am using the code as shown below



When I enter an invalid name, the message I get back is "Regex Pattern not matched". How do I get a custom message shown on the UI like "Name cannot contain invalid characters"
Should I write a custom validator?

Thanks in advance
 
Saloon Keeper
Posts: 28716
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a validatorMessage attribute to the inputText control. You have to have JSF 1.1 or higher, I think, and I may not have spelled the attribute name correctly, so it's best to check the JSF tag docs, but I do this all the time (also custom requiredMessage's).
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks TIm, it worked
 
reply
    Bookmark Topic Watch Topic
  • New Topic