我遇到了a4j:commandButton的问题。我试图完成的是:a4j:commandButton onbegin事件触发表单加载
我有一个提交和取消按钮的形式。当用户点击提交按钮时,我希望禁用这两个按钮,并弹出一个要求用户确认的提示。一旦用户确认,如果有验证错误,我希望重新启用提交和取消按钮。我尝试了很多解决方案,但似乎没有任何工作。如果您有比以下更好的解决方案,请发布。我的问题属于下面的代码
<h:panelGrid id="submitPanel" columns="2">
<a4j:commandButton id="addRequestButton" render="addRequestButton,cancelButton" onbegin="#{addRequestBean.disableSubmitButton()}" styleClass="LoginButtonStyle" value="Submit"
disabled="#{addRequestBean.submitEnabled}" oncomplete="#{addRequestBean.enableSubmitButton()}">
<rich:componentControl target="popup" operation="show" />
</a4j:commandButton>
<h:commandButton id="cancelButton" styleClass="LoginButtonStyle" value="Cancel" action="main" disabled="#{addRequestBean.submitEnabled}">
</h:commandButton>
</h:panelGrid>
<rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Verify"></h:outputText>
</f:facet>
<h:panelGrid id="popupgrid" columns="1">
<h:outputText styleClass="labelFontStyle" escape="false" value="All changes are final. <br />Do you wish to continue?"></h:outputText>
<h:outputLabel styleClass="labelFontStyle" value="" for="">
</h:outputLabel>
</h:panelGrid>
<h:panelGrid columns="2">
<h:commandButton styleClass="LoginButtonStyle" value="Ok" action="#{addRequestBean.saveRequest}" onclick="#{rich:component('popup')}.hide()">
</h:commandButton>
<h:commandButton styleClass="LoginButtonStyle" value="Cancel" onclick="#{rich:component('popup')}.hide()">
</h:commandButton>
</h:panelGrid>
</rich:popupPanel>
ViewScoped Bean。
我想onbegin事件设置支持bean变量为禁用,并oncomplete方法重新启用它。麻烦的是onbegin事件在表单加载时触发,因此禁用了Submit和Cancel按钮。必须有我做错的事,如果没有,是否有解决方法?再次如果有比这更好的解决方案,请张贴。
感谢