Jsf Popuppanel在验证后保持打开状态
我有一个rich faces popuppanel,我想一直打开,直到所有验证完成。现在,我只是在地址上有一个必需的属性。如果地址丢失且单击了“提交”按钮,则popuppanel应保持打开状态,直到输入地址。但是,当用户输入一个地址时,表单会发送电子邮件,但页面保持打开状态。输入必填字段时,我需要关闭popuppanelJsf Popuppanel在验证后保持打开状态,jsf,richfaces,Jsf,Richfaces,我有一个rich faces popuppanel,我想一直打开,直到所有验证完成。现在,我只是在地址上有一个必需的属性。如果地址丢失且单击了“提交”按钮,则popuppanel应保持打开状态,直到输入地址。但是,当用户输入一个地址时,表单会发送电子邮件,但页面保持打开状态。输入必填字段时,我需要关闭popuppanel <rich:popupPanel id="addressModalPanel" header="Change Billing Address" modal="true"
<rich:popupPanel id="addressModalPanel" header="Change Billing Address" modal="true" domElementAttachment="form" width="450" height="400">
<h2>Submit Change of Billing Address</h2>
<h:outputLabel value="Enter changes to your company's billing address in the fields below and then click Submit" /><br></br>
<h:panelGrid columns="2" >
<h:outputLabel value="Company Name: "/>
<h:inputText value="#{supplieraddress.supplierAddress.supplierName}" disabled="true" />
<h:outputLabel value="Vendor Number: " />
<h:inputText value="#{supplieraddress.supplierAddress.id}" disabled="true"/>
<h:outputLabel value="Address: " />
<h:inputText id="add1" value="#{supplieraddress.supplierAddress.add1}" required="true" requiredMessage="Address is required" style="width:200px" />
<h:outputLabel value=""/>
<h:inputText value="#{supplieraddress.supplierAddress.add2}" style="width:200px" />
<h:outputLabel value=""/>
<h:inputText value="#{supplieraddress.supplierAddress.add3}" style="width:200px" />
<h:outputLabel value="City: " />
<h:inputText id="city" value="#{supplieraddress.supplierAddress.city}" />
<h:outputLabel value="State: " />
<h:inputText id="state" value="#{supplieraddress.supplierAddress.state}" style="width:50px" />
<h:outputLabel value="Zip: " />
<h:inputText id="zip" value="#{supplieraddress.supplierAddress.zip}" style="width:50px" />
<h:outputLabel value="Country (If not US): " />
<h:inputText id="country" value="#{supplieraddress.supplierAddress.country}" style="width:50px" />
<a4j:commandButton id="submit" value="Submit" actionListener="#{supplieraddress.billingAddressEmail()}" oncomplete="if(#{!empty add1}) #{rich:component('addressModalPanel')}.hide()" >
</a4j:commandButton>
<h:commandButton value="Close" >
<rich:componentControl event="click" target="addressModalPanel" operation="hide" />
</h:commandButton>
<a4j:outputPanel ajaxRendered="true">
<rich:message for="add1" style="color:red"/>
</a4j:outputPanel>
</h:panelGrid>
</rich:popupPanel>
如果{!empty add1}看起来像是对空运算符的滥用;空仅应用于集合。你应该用什么来代替
<a4j:commandButton id="submit" value="Submit" actionListener="#{supplieraddress.billingAddressEmail()}" oncomplete="if(!#{facesContext.validationFailed}) #{rich:component('addressModalPanel')}.hide()" >
其中,facesContext.validationFailed是一种检查当前JSF上下文的验证状态的方便方法