When user updates data on his personal page I want to invoke a confirm dialog with password request to confirm that changes.
Here is my confirm button:
<p:commandButton value="Confirm" update="message" ajax="false" actionListener="#{customerBean.confirmChanges()}">
<p:confirm header="Confirm changes" icon="ui-icon-alert" message="Please enter your password to confirm changes:"/>
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Submit" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
<p:commandButton value="Cancel" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
<p:password value="#{customerBean.currentPassword}" required="true" redisplay="true" label="Current Password"/>
</p:confirmDialog>
And here is the corresponding method:
public String confirmChanges() {
if (currentPassword.equals(customer.getPassword())) {
saveCustomer();
logger.info("nCustomer updating SUCCESS.", " CustomerID:" + customer.getId());
addMessage("Updating Success", "Your information was successfully updated.", SEVERITY_INFO);
}
addMessage("Updating Error", "Your password is wrong please try again.", SEVERITY_ERROR);
currentPassword = null;
return null;
}
Now when I press the "Submit" button the dialog appears but doesn't invoke my method.
Aucun commentaire:
Enregistrer un commentaire