0
我已阅读SA和Primefaces论坛上的类似问题,但它没有帮助。这里是XHTML:confirmDialog出现,但立即消失
<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>
任何帮助非常感谢!
commandButton由JavaScript函数触发,该函数执行下列操作:document.getElementById('displayDialog')。click()。我以这种方式调整了你的建议:
然后没有任何反应(对话框没有打开)。如何在使用onclick触发commandButton时使用oncomplete?谢谢! – seinecle
好的我在这里打开了一个新的问题:http://stackoverflow.com/questions/13101960/using-oncomplete-in-a-commandbutton-even-when-onclick-is-empty – seinecle
哦,我忽略了'键入=“按钮”,我根本没有想到它在这里。去掉它。不确定它是否可以解决您的具体功能需求。毕竟,隐藏的死亡按钮在这个构造中很奇怪。我想知道你为什么不在'updateDialog'函数中执行'cd.show()',因为它具有基本相同的效果。根据目前提供的代码和信息,使用'
'本身的'oncomplete'会更有意义。 – BalusC