仅在验证成功时显示p:确认对话框

时间:2018-04-05 09:25:15

标签: primefaces confirm-dialog

所以,基本上我只想在确认对话框弹出之前添加验证,但问题是当我在命令按钮之间添加<p:confirm>时,验证错误在确认对话之前没有弹出,即使是if (!args.validationFailed) PF('dlg1').show();

所以我删除它,并使用此代码更改,现在问题是验证工作,但确认对话框弹出如此之快,是 - 没有按钮没有显示。

<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>

任何帮助都会很棒:)

0 个答案:

没有答案
相关问题