showing js popup window prior to showing modalPanel on submit
asookazian Jul 30, 2010 12:19 PMI have a use case which requires showing a js confirm warning window to the user when they click the submit button of the form:
<a4j:commandLink styleClass="widget_button"
rendered="#{pageaction != 'view'}"
style="float:right"
action="#{merchantBillingGroupEditorUI.submit}"
onclick="return showWarning();"
oncomplete="hideProgress();">
<span><h:outputText value="Finish" /></span>
<j4j:idProxy id="nextButton" />
</a4j:commandLink>
The js which shows the modalPanel is showProgress().
I am also using Seam remoting as below:
<script type="text/javascript" src="/cis/seam/resource/remoting/resource/remote.js"></script>
<script type="text/javascript" src="/cis/seam/resource/remoting/interface.js?merchantBillingGroupEditorUI"></script>
<script type="text/javascript">
function showWarning() {
var rtn = null;
var callback = function(result) {
if (result == null || result == '') {
rtn = confirm('No interchange programs were assigned to rate category. Are you sure you want to proceed with saving?');
if (rtn == true) {
//showProgress();
return true;
}
else
return false;
}
};
Seam.Remoting.getContext().setConversationId( #{conversation.id} );
Seam.Component.getInstance("merchantBillingGroupEditorUI").getSelectedRateCategory(callback);
}
</script>
If the user clicks cancel to the confim window, I don't want the action method (submit) in the a4j:commandLink to execute and the modalPanel (please wait dialog) should not display either. I *do* want it to execute and modalPanel to display if the user clicks ok to the confirm window.
How can I achieve this? Currently I can't get this to work. thx.