Reputation: 27899
I'm using some OminFaces (1.8.1) validators as for example,
<o:validateAllOrNone components="a b c d" showMessageFor="someComponent"/>
If at least one of the specified fields is left blank in which case it displays a default message like as shown below.
a, b, c, d: Please fill out all or none of those fields
I want to override such error messages in resource bundles especially to get a localized message.
Unlike JSF, no resource bundles are found in OmniFaces. Is this still possible to override this error message somehow?
Upvotes: 2
Views: 480
Reputation: 1109222
You can use the message
attribute for that.
<o:validateAllOrNone components="a b c d" showMessageFor="someComponent"
message="#{i18n['some.bundle.key']}" />
where i18n
is the <resource-bundle><var>
of your resource bundle.
Indeed, the OmniFaces ValidateMultipleFields
components do not support providing those messages via <message-bundle>
without the need to declare the message
attribute everytime.
Coincidentally, 3 days ago I've for the upcoming OmniFaces 2.0 committed several changes in those validators which should make it possible to override the default message via <message-bundle>
when using the component type as key. So in case of <o:validateAllOrNone>
which has a component type of "org.omnifaces.component.validator.ValidateAllOrNone"
, you should be able to override it in the resource bundle as identified by <message-bundle>
as follows:
org.omnifaces.component.validator.ValidateAllOrNone = {0} all or none!
Upvotes: 3