假设p:dialog
在提交按钮上有一个<o:validateOne>
,p:dialog
将关闭,即使仍然需要验证,对话框也会关闭
<h:form>
<h:outputText id="newValueId" value="#{myBean.newValue}/>
<p:dialog id="dialog" widgetVar="dlg" resizable="false" dynamic="true"
appendToBody="false" modal="true">
<o:validateOne id="one" components="name1 name2"
message="one is required"/>
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel value="name 1 :" />
<p:inputText value="#{myBean.name1}" id="name1"/>
<h:outputLabel fvalue="name 2 :" />
<p:inputText value="#{myBean.name2}" id="name2"/>
<p:commandLink id="okId" value="ok" update="growl newValueId"
action="#{myBean.updateMyForm}"
process="dialog"
oncomplete="if(!args.validationFailed())dlg.hide();"/>
</h:panelGrid>
</p:dialog>
class Mybean{
String name1,name2,newValue;
public void updateMyForm(){
newValue=name1 + " " + name2;
}
//getter and setters
}
如果两个输入input1和input2仍为空,我希望对话框不关闭 但正在发生的事情是对话框已关闭,消息显示在咆哮中