0

I tried editing PrimeFaces locale message but the changes is not reflecting. I already check the widget of calendar in web console and the changes is already there. But still it uses the default message.

Calendar_en_US.js

PrimeFaces.locales['en_US'] = {
                //other stuff
                messages : {
                    ..
                    'javax.faces.converter.DateTimeConverter.DATE_detail':'[E-WAR-0037][E-WAR-0037] {2}: \'{0}\' could not be understood as a date. Example: {1}',
                    ..
            };

and attached to page by

    <h:outputScript library="js" name="${request.contextPath}/resources/js/calendar_en_US.js" />

and used it to calendar

    <p:calendar widgetVar="issueDateVar" id="issueDate" pattern="yyyy-MM-dd"  size="14" showOn="button"  locale="en_US"
                            navigator="true" styleClass="#{maintainUi.requiredStyleClass}" onblur="transformVal(this);"
                            value="#{maintainUi.obj.IssueDate}"
                            disabled="#{maintainUi.readOnly}"/

The message error is still

Warrant Issue Date: '999' could not be understood as a date. Example: 2019-04-17

it Should be

[E-WAR-0037]Warrant Issue Date: '999' could not be understood as a date. Example: 2019-04-17

acer22
  • 11
  • 2
  • 2
    Possible duplicate of [Change the default message "Validation Error: Value is required" to just "Value is required"](https://stackoverflow.com/questions/9155684/change-the-default-message-validation-error-value-is-required-to-just-value) – Jasper de Vries Apr 17 '19 at 07:30
  • or https://stackoverflow.com/questions/10411773/how-to-customize-jsf-validation-error-message – Jasper de Vries Apr 17 '19 at 07:30
  • This is different bec. calendar use locale for its config including its error msgs – acer22 Apr 17 '19 at 07:56
  • Are you absolutly sure you are using client side validation? Else [this is the source](https://github.com/eclipse-ee4j/mojarra/blob/2d22f78f81548c10f2c48a8fd8a04caa1628c0b3/impl/src/main/resources/javax/faces/Messages_en.properties#L40) of your current validation message. – Selaron Apr 17 '19 at 09:57

1 Answers1

1

Starting from JSF 1.2, use the converterMessage attribute to replace the entire message.

I found my solution here

Custom Variables in JSF Converter's Error Message

acer22
  • 11
  • 2