Reputation: 388
I am using Omnifaces 1.7 to validate multiple fields in my JSF 2 form. More precisely, I use the following snippet
<o:validateMultiple
id="activiteValidator"
components="programmeCreation programmeReport dateEcheance"
validator="#{activiteControleFacesValidator}"
message="L'activité n'est pas cohérente." />
which works as intended except for one small glitch ; the quotes in the error message are lost when the message is shown because the validation error is triggered. This is what I get in the HTML in case of validation failed
Lactivité nest pas cohérente.
If you know what is wrong with this configuration or how I could circumvent that problem, I would be most thankful.
Update : if I try to escape the quote, it still doesn't work. When message="L\'activité"
, the HTML result is L\activité
.
Upvotes: 1
Views: 346
Reputation: 1109222
This is caused by the MessageFormat
API which is under the covers being used for message formatting (substituting {0}
, {1}
, etc). The apostrophe (single quote) is actually an escape character.
You need to escape the single quote by another one in order to display it as-is.
<o:validateMultiple
...
message="L''activité n''est pas cohérente." />
An alternative is to use a curly right single quote.
<o:validateMultiple
...
message="L’activité n’est pas cohérente." />
Upvotes: 4