gpt4 book ai didi

java - 无法设置必需的 selectOneChoice

转载 作者:太空宇宙 更新时间:2023-11-04 14:41:17 25 4
gpt4 key购买 nike

在我的片段中,我有

<af:selectOneChoice value="#{pageFlowScope.loanPurposeBean.loanPurpose.levelPurpose}" contentStyle="width:150px"
autoSubmit="true" readOnly="#{pageFlowScope.loanPurposeBean.activity=='edit'}"
required="true" label="Cấp mục đích vay" id="soc1"
valueChangeListener="#{pageFlowScope.loanPurposeBean.valueChangeLevel}">
<af:selectItem label="1" value="1" id="si10"/>
<af:selectItem label="2" value="2" id="si5"/>
<af:selectItem label="3" value="3" id="si6"/>
<af:selectItem label="4" value="4" id="si3"/>
<af:selectItem label="5" value="5" id="si9"/>
<af:selectItem label="6" value="6" id="si8"/>
<af:selectItem label="7" value="7" id="si4"/>
<af:selectItem label="8" value="8" id="si1"/>
<af:selectItem label="9" value="9" id="si2"/>
<af:selectItem label="10" value="10" id="si7"/>
</af:selectOneChoice>

<af:selectOneChoice value="#{pageFlowScope.loanPurposeBean.loanPurpose.loanPurposeParent}"
immediate="true"
binding="#{pageFlowScope.loanPurposeBean.socLoanPurposeParent}" contentStyle="width:150px"
partialTriggers="soc1" readOnly="#{pageFlowScope.loanPurposeBean.activity=='edit'}"
label="Mã cha mục đích vay" id="soc2">
<f:selectItems value="#{pageFlowScope.loanPurposeBean.loanPurposeByLevel}"
id="si12"/>
</af:selectOneChoice>

和我的 bean

public void valueChangeLevel(ValueChangeEvent valueChangeEvent) {
level = (Integer)valueChangeEvent.getNewValue();
System.out.println("New value level: " + level);
if (level > 1) {
socLoanPurposeParent.setDisabled(false);
socLoanPurposeParent.setRequired(true);
} else {
socLoanPurposeParent.setDisabled(true);
socLoanPurposeParent.setValue("");
}
if (level > 0) {
level = level - 1;
}
RequestContext.getCurrentInstance().addPartialTarget(socLoanPurposeParent);

}

如果我选择值> 1的级别,我设置required = true,然后我选择值= 1的级别并设置required = false,但我仍然从selectonechoice soc2获得验证

最佳答案

执行以下操作this.getsoc2().setRequired(true);

关于java - 无法设置必需的 selectOneChoice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24902145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com