jsf - Primefaces dialog only working once -
i got menu opening dialog (primefaces 3.5)
<h:form> <p:graphicimage id="img" value="../resources/img/user.jpg" style="cursor:pointer" title="my profile" height="70px"/> <p:overlaypanel id="imgpanel" for="img" showeffect="blind" hideeffect="fade" showevent="mouseover" hideevent="fade"> <h:outputlink id="editlink" value="javascript:void(0)" onclick="profiledlg.show()" title="login">edit profile</h:outputlink><br /> <h:outputlink id="loginlink" value="javascript:void(0)" onclick="passwddlg.show()" title="login">change password</h:outputlink><br /> <p:commandlink action="#{authbackingbean.logout}" value="logout" /> </p:overlaypanel> </h:form>
the dialog looks this:
<h:form id="profiledialogform"> <p:dialog id="profiledialog" header="edit profile" widgetvar="profiledlg" resizable="false"> <h:panelgrid columns="2" cellpadding="5"> <h:outputlabel for="email" value="email:" /> <p:inputtext value="#{editprofilebean.newemail}" id="email" required="true" label="email" /> <f:facet name="footer"> <p:commandbutton id="editprofilebutton" value="edit profile" actionlistener="#{editprofilebean.editprofile}" oncomplete="profiledlg.hide()" update=":profiledialogform" > <p:resetinput target=":profiledialogform" /> </p:commandbutton> </f:facet> </h:panelgrid> </p:dialog> </h:form>
the first time use it, works intended, second (or more) time enter different email , click button dialog closes method not called, if manual page refresh (f5).
the bean @requestscoped
i set newemail value "" (empty string) @ end of editprofile method.
any toughts?
i got managed , want share answer of you.
if use glassfish 4.0 (ships jsf 2.2) have use primefaces 4.0 (currently snapshot) following code works intended:
<div id="header_right" class="floatr"> <h:form> <p:graphicimage id="img" value="../resources/img/user_1.jpg" style="cursor:pointer" title="my profile" height="70px"/> <p:overlaypanel id="imgpanel" for="img" showeffect="blind" hideeffect="fade" showevent="mouseover" hideevent="fade"> <p:commandlink value="edit profile" update=":profiledialog" oncomplete="pf('profiledlg').show()"> <p:resetinput target=":profiledialogform" /> </p:commandlink><br /> <p:commandlink value="change password" update=":passwddialog" oncomplete="pf('passwddlg').show()"> <p:resetinput target=":passwddialogform" /> </p:commandlink><br /> <p:commandlink action="#{authbackingbean.logout()}" value="logout" /> </p:overlaypanel> </h:form> <p:dialog id="passwddialog" header="change password" widgetvar="passwddlg" resizable="false"> <h:form id="passwddialogform"> <h:panelgrid columns="2" cellpadding="5"> <h:outputlabel for="oldpasswd" value="old password:" /> <h:inputsecret value="#{changepasswordbean.oldpassword}" id="oldpasswd" required="true" label="oldpassword" /> <h:outputlabel for="password" value="new password:" /> <h:inputsecret value="#{changepasswordbean.newpassword}" id="password" required="true" label="password" /> <f:facet name="footer"> <p:commandbutton id="changepasswordbutton" value="change password" action="#{changepasswordbean.changepassword}" update="@form" oncomplete="if (args && !args.validationfailed) pf('passwddlg').hide()"> </p:commandbutton> </f:facet> </h:panelgrid> </h:form> </p:dialog> <p:dialog id="profiledialog" header="edit profile" widgetvar="profiledlg" resizable="false"> <h:form id="profiledialogform"> <h:panelgrid columns="2" cellpadding="5"> <h:outputlabel for="email" value="email:" /> <p:inputtext value="#{editprofilebean.newemail}" id="email" required="true" label="email" /> </h:panelgrid> <p:commandbutton value="edit profile" action="#{editprofilebean.editprofile}" update="@form" oncomplete="if (args && !args.validationfailed) pf('profiledlg').hide()" /> </h:form> </p:dialog> </div>
Comments
Post a Comment