This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF validation" Watch "JSF validation" New topic
Author

JSF validation

Maciej Kaweski
Greenhorn

Joined: Mar 06, 2011
Posts: 2
Hi all

I use hibernate validator 4.0.2-GA (implementation of JSR 303) to validate my input fields. All works fine, but it always displays the message with the client id:

typeForm:title: Bitte einen Titel zwischen 6 und 128 Zeichen eingeben.

I want to get rid of this client id. Only the error message should be displayed:

Bitte einen Titel zwischen 6 und 128 Zeichen eingeben.

How can I do this?

Thanks a lot!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

Welcome to the JavaRanch, Maciej!

You can replace the validation message text on a generic basis for the entire webapp by defining and registering an alternate set of message text properties to JSF. However, since JSF 2 (or maybe 1.2), you can also define a message that's customized for just the control that you are already using. The attribute name is, I believe "validationMessage".


Customer surveys are for companies who didn't pay proper attention to begin with.
Maciej Kaweski
Greenhorn

Joined: Mar 06, 2011
Posts: 2
Hi
I already use the ValidationMessages property. I located the bug/fearure in MyFaces. It always prepends the label of the UInput, and if it is not defined, it prepends the ID. I didn't find a way to turn it off. I switched to Mojarra and everything is working fine now.
But if you know how to turn this behaviour off in MyFaces, please let me know.

Regards
Joschi
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

I has been a long time, but I think there actually is something for that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF validation