がある値に設定されている場合、必要な属性selectOneChoice
をinputText から削除したいので、はの id を持ちますが、値を から変更すると (そして変更が送信されます) ) 必要な検証は、更新が必要なコンポーネントに対してのみトリガーされます (partialTriggers が存在するため) 他の必要なコンポーネントはその検証をトリガーしません。回避策はありますか?autoSubmit=true
immediate=true
selectOneChoice
inputText
partialTrigger
selectOneChoice
selectOneChoice
7316 次
3 に答える
3
valueChangeListenerで必要なインジケーターを変更する必要があります。これは、モデルが更新される前に発生します。
たとえば、このJSFフラグメントがあるとします。
<af:panelFormLayout id="pfl1">
<af:inputText label="Label 1" id="it1" value="#{pageFlowScope.RemoveRequiredBean.myValue}" required="true" partialTriggers="soc1"/>
<af:selectOneChoice label="Selection" value="#{pageFlowScope.RemoveRequiredBean.selection}" id="soc1" autoSubmit="true" immediate="true"
valueChangeListener="#{pageFlowScope.RemoveRequiredBean.selectionChange}">
<af:selectItem label="one" value="one" id="si3"/>
<af:selectItem label="two" value="two" id="si1"/>
<af:selectItem label="three" value="three" id="si2"/>
</af:selectOneChoice>
<af:commandButton text="commandButton 1" id="cb1"/>
<f:facet name="footer"/>
</af:panelFormLayout>
そして、このリスナーは、あなたが説明する振る舞いを取得します。
public void selectionChange(ValueChangeEvent valueChangeEvent) {
String newValue = valueChangeEvent.getNewValue().toString();
RichInputText it = (RichInputText)valueChangeEvent.getComponent().findComponent("it1");
it.setRequired(!"two".equals(newValue));
}
于 2011-08-26T15:18:26.887 に答える
0
inputText の必須属性の EL 式を投稿できますか?
<af:inputText label="ResId" id="it1" required="#{someValueExpression}"
partialTriggers="soc1">
</af:inputText>
<af:selectOneChoice label="Label 1" id="soc1" autoSubmit="true">
<af:selectItem label="test" value="test" id="si1"/>
<af:selectItem label="test2" value="test2" id="si12"/>
</af:selectOneChoice>
于 2011-08-02T20:58:45.750 に答える