I have a primefaces calendar with a validator attached to it.
<p:calendar id="validationTriggeringCalendar"
label="other calendar"
value="#{myBean.otherDate}"
navigator="true"
locale="de"
pattern="dd.MM.yyyy"
showOn="button"
renderAsPopup="true"
required="true"
size="12">
<f:validator validatorId="packagename.DateFromToValidator" />
</p:calendar>
<p:calendar id="myCalendar"
label="Some Date"
value="#{myBean.someDate}"
navigator="true"
effect=""
locale="de"
pattern="dd.MM.yyyy"
showOn="button"
renderAsPopup="true"
mindate="#{myBean.mindate}"
size="12">
</p:calendar>
Inside the validator I get the calendar UI component myCalendar
(the one that did not trigger the validation) and call the getValue()
method, which does not return the value that is entered into it.
I debugged the validator code entering the date "10.10.2009":
UIInput calendar = getMeTheCalendar();
Date date = (Date) calendar.getValue();
My debugger even tells me the value of the submittedValue
attribute of the calendar
is "10.10.2009", exactly what I entered and what is displayed in my browser. But the getValue()
method returns a date object Thu Oct 10 00:00:00 CEST 2019
.
How do I get the entered value of the component?
I use Primefaces 5.3.1 btw.