Bug Calendar processUpdates / updateModel
Posted: 14 Jan 2019, 13:08
Dear all.
I've got the following structure in my app:
- h:form
-- composite:component
--- p:calendar
The calendar is set up like this:
IMPORTANT: the value is a String object and the converter is a LocalDate -> String converter!
When entering a date with navigator or directly the conversion in the calender class is called and the conversion to String is correctly done by the converter. Ajax is also called, everything looks ok.
Now the problem:
When submitting the form and executing a search the calendar first takes the value correct and tries to submit the form. During rerendering the calender wants to rerender the input value, but it does not use the given pattern or converter, it uses the standard function of UIInput class.
The following methods were called:
- ...
- Calender(UIInput).processUpdates
- Calender(UIInput).updateModel
- ...
- ELSupport.coerceToType
- ...
- ELSupport.coerceToString
- LocalDate.ToString
Because LocalDate.toString gives a yyyy-MM-dd value, the value of the calender is in the wrong format.
In my app, the user can save the input values of a search, and the saved format is wrong then. Should be dd.MM.yyyy but is yyyy-MM-dd.
I think it is a bug, the Calender class should override the methods of UIInput to use the converter to get the correct String format of the input. PF version is 6.1.
kind regards
Lars
I've got the following structure in my app:
- h:form
-- composite:component
--- p:calendar
The calendar is set up like this:
Code: Select all
<p:calendar
id=..."
value="#{cc.attrs.valueFrom}"
pattern="dd.MM.yyyy"
locale="de"
navigator="true"
converter="#{cc.attrs.converter}"
styleClass="..."
disabled="..."
required="...">
<p:ajax ...
When entering a date with navigator or directly the conversion in the calender class is called and the conversion to String is correctly done by the converter. Ajax is also called, everything looks ok.
Now the problem:
When submitting the form and executing a search the calendar first takes the value correct and tries to submit the form. During rerendering the calender wants to rerender the input value, but it does not use the given pattern or converter, it uses the standard function of UIInput class.
The following methods were called:
- ...
- Calender(UIInput).processUpdates
- Calender(UIInput).updateModel
- ...
- ELSupport.coerceToType
- ...
- ELSupport.coerceToString
- LocalDate.ToString
Because LocalDate.toString gives a yyyy-MM-dd value, the value of the calender is in the wrong format.
In my app, the user can save the input values of a search, and the saved format is wrong then. Should be dd.MM.yyyy but is yyyy-MM-dd.
I think it is a bug, the Calender class should override the methods of UIInput to use the converter to get the correct String format of the input. PF version is 6.1.
kind regards
Lars