This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 17166
    
  27

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".


An IDE is no substitute for an Intelligent Developer.
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: 17166
    
  27

I has been a long time, but I think there actually is something for that.
 
wood burning stoves
 
subject: JSF validation
 
It's not a secret anymore!