假设我在模态对话框面板中有三个输入:
字段 A:
<h:inputText id="fieldA" value="#{callbackDialog.fieldA}" required="true">
字段 B:
<h:inputTextarea id="fieldB" value="#{callbackDialog.fieldB}" required="false" rows="4" onkeyup="this.value = this.value.substring(0, 255);"/>
字段 C:
<h:selectOneMenu id="fieldC" value="#{callbackDialog.fieldC}" required="true">
<s:selectItems value="#{callbackDialog.fieldCList}"
var="fieldC"
label="#{fieldC.name}"
hideNoSelectionLabel="true"
noSelectionLabel="Empty"/>
<s:convertEntity />
</h:selectOneMenu>t>
我在模态面板上还有一个取消按钮:
<a4j:commandLink styleClass="btn-standard"
immediate="true"
action="#{generalDialogAction.forwardCancelButton()}"
oncomplete="#{rich:component('modalPanel')}.hide(); Event.stop(event); return false;">
<span><h:outputText value="Cancel"></h:outputText></span>
</a4j:commandLink>
现在字段 A 和 C 是必填字段。是否有一种通用方法可以让按钮(在本例中为 Cancel
按钮)检查页面上的哪些输入字段是必需的,如果是,则在 Cancel
时清除它们的值。被点击?请帮忙!
最佳答案
只是一个猜测......尝试,
<h:commandButton id="btnReset" value="Cancel" type="reset" />
关于java - RichFaces:单击取消按钮时清除必填字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6206746/