0

我在 SA 和 Primefaces 论坛上阅读过类似的问题,但没有帮助。这是xhtml:

<h:form id="form2" prependId="false">
    <p:remoteCommand name="sendNameClicked" actionListener="#{reportBean.passName}"/>
    <p:remoteCommand name="updateDialog" update=":form3:dialogBox"/>

    <p:commandButton style="display: none" id="displayDialog" type="button" onclick="cd.show(); return false;"/>
</h:form>
<h:form id="form3">
    <p:confirmDialog id ="dialogBox" message= "#{reportBean.getClickedAuthorLaius()}"
                     header="#{reportBean.nameClicked}#{reportBean.authorClicked.mostRecentAffiliation}"
                     widgetVar="cd"
                     severity="info"
                     >
        <h:outputText styleClass="ui-widget"  value="" escape="false" />
        <p:commandButton value="Draw the ring of #{reportBean.obtainFullName()}?" actionListener ="#{controllerBean.prepareNewSearch()}" action ="index?faces-redirect=true" oncomplete="cd.hide();"/>
        <p:commandButton value="No, stay on this page" onclick="cd.hide();" type="button" />
    </p:confirmDialog>
</h:form>

非常感谢任何帮助!

4

1 回答 1

2

onclick发送表单提交请求之前触发。在update表单提交响应到达后执行。因此,确认对话框在打开后会更新,从而再次获得其默认外观。

您需要在更新后打开它。使用oncomplete属性而不是onclick.

<p:commandButton ... oncomplete="cd.show()"/>
于 2012-10-27T14:45:16.057 回答