Currently, I am utilizing JSF ajax within my application and unfortunately, we are unable to make any changes to that. In the process of waiting for user action, I find it necessary to prompt the user before executing the ajax method. Specifically, I need to inquire if the user wishes to revert all changes on the page using a custom dialog. If they choose to proceed with the reversion, I will invoke the Java method through ajax. However, if they decide against it, there is no need to execute the ajax.
To elaborate further:
Here is the code snippet for the revert button in my extensive page:
<h:commandButton value="#{msg.revertBtn}" accesskey="R" styleClass="actionButton" action="#{styleController.revertChanges}">
<f:ajax execute="@this" onstart="return method();" render="styleCcFormtyleCcTable">
</h:commandButton>
Prior to initiating the ajax, it triggers my javascript function: method()
I require the user to remain engaged in method()
until they click either the Yes
or No
button in my customized confirmation dialog, and then return true or false accordingly.
Do you have any suggestions on how to address this issue?