I would like to call confirmDialogusing support. This code works fine, but how can I set the message and install the confirmDialog actionlistener with support? There are two conditions:
- The user checks option A on the checkbox (I missed the code), then he must directly print the text for the console. โ This is done using the code below
- The user checks option B on the checkbox, then he should show the Dialog confirmation, and while the user presses the YES button, he should call another function based on.
How to do it? Thanks.
<p:commandButton value="Execute" icon="ui-icon-circle-check" update="frmContent" actionListener="#{backing.validate}" />
<p:confirmDialog id="cfmDlg" widgetVar="wvCfmDlg" global="true" >
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
In backup:
public void validate() {
if(mode.equals("1")) {
System.out.println("OK");
} else {
RequestContext context = RequestContext.getCurrentInstance();
context.execute("wvCfmDlg.show();");
}
}
source
share