Custom error messages for f:validatexxxx?

UI Components for JSF
Post Reply
User avatar
bjorntj
Posts: 277
Joined: 30 Jul 2010, 10:46

25 Sep 2016, 10:22

I am having problem customizing error messages from f:validatexxx.. I have the following code:

Code: Select all

<p:inputText id="tempmin" value="#{weatherController.weather.tempMin}" tabindex="2" required="true" requiredMessage="#{msgs.valueRequired}">
      <f:converter converterId="doubleConverter" />
      <f:attribute name="maxFractionDigits" value="1" />
      <f:attribute name="minFractionDigits" value="1" />
      <f:validateDoubleRange minimum="-30" maximum="40" />
      <p:ajax event="change" update="tempminmessage,tempmin" process="@this"/>
</p:inputText>
<p:message id="tempminmessage" for="tempmin"/>
I have tried putting the following in my text resource files:

Code: Select all

javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE={2}: Validering feilet: Verdien er ikke mellom gyldig verdi på {0} og {1}

Also tried adding the following in a custom js file (but I think this is just for client side validation?):

Code: Select all

PrimeFaces.locales['no'].messages['javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE'] = '{2}: Validering feilet: Verdien er ikke mellom gyldig verdi på {0} og {1}';

What am I missing?


Regards,

BTJ
PrimeFaces 11.x | PrimeVue 3.x | Spring Boot 2.7.x | Undertow | Mojarra 2.3.x
Mac OS, Firefox and Chromium

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

25 Sep 2016, 11:42

https://www.mkyong.com/jsf2/customize-v ... n-jsf-2-0/

Not related to PF if you don't use CSV.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

User avatar
bjorntj
Posts: 277
Joined: 30 Jul 2010, 10:46

25 Sep 2016, 11:46

Well, this is what I have done but my custom messages are not used....
PrimeFaces 11.x | PrimeVue 3.x | Spring Boot 2.7.x | Undertow | Mojarra 2.3.x
Mac OS, Firefox and Chromium

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests