Show p:confirm dialog only when validation is success

481 Views Asked by At

So, basically I just want to add validation before confirmation dialog popout, but the problem is when I add <p:confirm>between command button the validation error didn't popout before confirm dialog even with if (!args.validationFailed) PF('dlg1').show();.

so I remove that, and change with this code, and now the problem is validation works, but the confirmation dialog is pop out so fast and yes - no button didn't show up.

<h:panelGrid columns="2" cellpadding="3" styleClass="ubahbatal">
    <p:commandButton styleClass="buttonedit" value="#{UIBundle['text.page.button.edit']}" action="#{decreeBacking.updateDecree}" oncomplete="if (!args.validationFailed) PF('dlg1').show();">  </p:commandButton>
    <p:commandButton styleClass="buttonsbataledit" immediate="true" value="#{UIBundle['text.page.button.cancel']}" action="#{decreeBacking.cancel}"></p:commandButton>
</h:panelGrid>

<p:confirmDialog widgetVar="dlg1" global="true" showEffect="fade" hideEffect="fade" severity="alert" closable="false">
    <p:commandButton value="#{UIBundle['text.page.button.yes']}" type="button" styleClass="ui-confirmdialog-yes" onclick="dlg1.hide()" icon="ui-icon-check" />
    <p:commandButton value="#{UIBundle['text.page.button.no']}" type="button" styleClass="ui-confirmdialog-no" onclick="dlg1.hide()" icon="ui-icon-close" />
 </p:confirmDialog>

Any help would be great:)

0

There are 0 best solutions below