I'm using a calendar with showOn="button" and I want to validate that a value was inserted when focus is lost, using required="true", p:ajax and a message. The problem is that when I click the calendar button and choose a date, the validator message appears for a second and then dissapears. I think it should never appear. Also, if I first click in the input field of the calendar and then click the calendar button, the validator message appears, and doesn't dissapear until I select a date.
Then I have a second calendar. If I click the calendar button and select a date, the validator message appears and doesn't go away.
here's the code:
Code: Select all
<h:outputLabel value="Date from" />
<p:calendar id="dateFrom" value="#{applications.dateFrom}" label="Date from"
required="true" pattern="dd/MM/yyyy" showOn="button"
selectListener="#{applications.handleDateFromSelect}"
onSelectUpdate="dateTo dateFromVal">
<p:ajax event="blur" process="dateFrom" update="dateFromVal"/>
</p:calendar>
<p:message id="dateFromVal" for="dateFrom" display="icon"/>
<h:outputLabel value="Date to" />
<p:calendar id="dateTo" value="#{applications.dateTo}" label="Date to"
showOn="button" pattern="dd/MM/yyyy" required="true"
mindate="#{applications.dateFrom}"
onSelectProcess="dateTo" onSelectUpdate="dateToVal">
<p:ajax event="blur" update="dateToVal"/>
</p:calendar>
<p:message id="dateToVal" for="dateTo" display="icon"/>
Code: Select all
public void handleDateFromSelect(DateSelectEvent event) {
dateFrom = event.getDate();
}
Thank you very much,
Damian