JSF 2.0 + Ajax with PrimeFaces 3.5 not working -
i having problems , couldn't figure them out after 3 days of search. using jsf + primefaces 3.5 + ajax , not working correctly.
basically have startdate , numberofdays attributes. want calculate enddate automatically using ajax when both startdate , numberofdays informed.
these problems:
it not updating attribute enddate. listener called (i've breakpointed it!) , attribute calculated sure.
the listener called once. can't make run twice!
this xhtml page:
<div> <h:outputlabel for="startdate"> <h:outputformat value="startdate" /> <h:inputtext id="startdate" value="#{bean.startdate}"> <f:convertdatetime type="date" pattern="mm/dd/yyyy" /> </h:inputtext> </h:outputlabel> </div> <div> <h:outputlabel for="numberofdays"> <h:outputformat value="numberofdays" /> <h:inputtext id="numberofdays" value="#{bean.numberofdays}"> <p:ajax listener="#{bean.calculateenddate}" process="startdate,numberofdays" update="panelgroupenddate" partialsubmit="true" /> </h:inputtext> </h:outputlabel> </div> <div> <h:panelgroup id="panelgroupenddate"> <h:outputlabel for="enddate"> <h:outputformat value="enddate" /> <h:inputtext id="enddate" value="#{bean.enddate}"> <f:convertdatetime type="date" pattern="mm/dd/yyyy" /> </h:inputtext> </h:outputlabel> </h:panelgroup> </div>
here managed bean
public void calculateenddate() { if(startdate != null && numberofdays != null) { enddate = util.calculateenddate(startdate, numberofdays); } else { enddate = null; } }
i have ajax codes running in different pages without problem these codes triggered commandbutton. these same example works if use commandbutton trigger listener.
does know doing wrong? thanx lot! :)
check out:
<p:ajax listener="#{bean.calculateenddate}" process="startdate,numberofdays, @this" update="panelgroupenddate" />
i have faced problem listener method not called, adding @this end of process can make right.
Comments
Post a Comment