Khinsu
Khinsu

Reputation: 1487

Override Omnifaces Validation Message with JSF message-bundle?

Is it possible to override the default omnifaces validation messages with a jsf message-bundle?

my message-bundle:

javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date.
javax.faces.converter.DateTimeConverter.DATE_detail=Invalid date format.
javax.faces.validator.LengthValidator.MINIMUM=Minimum length of ''{0}'' is required.

org.omnifaces.component.validator.ValidateUnique=1. my validateUnique omnifaces msg, {0}
org.omnifaces.component.validator.ValidateUnique.DEFAULT_MESSAGE=2. my validateUnique omnifaces msg, {0}

i know there is an 'message' attribute but it would be nice to have all message at one place.

many thanks in advance

Upvotes: 6

Views: 559

Answers (1)

BalusC
BalusC

Reputation: 1109222

This is currently not supported by OmniFaces validator components. As you can see in the source code of ValidateMultipleFields#showMessage(), it's nowhere obtaining the default message from the message bundle as identified by Application#getMessageBundle().

I reported an issue so that the OmniFaces guys are noticed about it and may implement it for the next version. In the meanwhile your best bet is to keep using the message attribute. You can if necessary refactor the code duplication into a custom tagfile.

Upvotes: 3

Related Questions