Override Omnifaces Validation Message with JSF message-bundle?
Asked Answered
A

1

6

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

Andryc answered 11/6, 2014 at 11:1 Comment(0)
D
3

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.

Devitrify answered 11/6, 2014 at 15:44 Comment(2)
Thank you, is there a way to get a notification when Omnifaces will have implemented it? Would you be so kind roughly outline, to do it by myself?Andryc
Click the issue link and either press the subscribe button, or post a comment which will autosubscribe you.Devitrify

© 2022 - 2024 — McMap. All rights reserved.