ajax - How to submit manual entered date in primefaces calendar? -
i've got form 2 primefaces calendar input elements , datatable on it. calendar items used filter result displayed in table values. therefore use p:ajax ‘dateselect’ event working fine when doing manipulation mouse on popup. when change date manually in input field keybord no change event fired. when use second p:ajax event blur or change i'm not able new value.
<p:calendar id="startdate" value="#{filterstart}" required="true" showon="button" maxdate="#{filterend}" > <p:ajax event="dateselect" listener="#{listcontroller.onfilterstartchanged}" update="filtertbl, enddate" /> <p:ajax event="change" listener="#{listcontroller.onfilterstartblured}" update="filtertbl, enddate" process="@this" partialsubmit="true" immediate="true" /> </p:calendar>
the method onfilterstartchanged gets called when selection made on pupup it's possible read new value:
public void onfilterstartchanged(final selectevent event) {...}
but keyboard changes not fired when moving focus component
public void onfilterstartblured(final ajaxbehaviorevent event) { date newdate = (date)((calendar)event.getsource()).getvalue(); ... }
how can new date?
i have same need p:calendar in primefaces 5.3 , it's work me whit code. don't use event parameter
<p:calendar id="startdate" value="#{filterstart}" required="true" showon="button" maxdate="#{filterend}" > <p:ajax event="dateselect" listener="#{listcontroller.onfilterstartchanged()}" update="filtertbl, enddate" /> <p:ajax event="change" listener="#{listcontroller.onfilterstartchanged()}" update="filtertbl, enddate/></p:calendar>
no parameter in method, value in filterstart
public void onfilterstartchanged() {...}
Comments
Post a Comment