我有一个af:inputDate,我将根据对af:selectOneChoice的选择禁用几个月,该选择有3个选择:Quarter,Semi_Annual和Annual
-如果我选择季度,那么它将仅启用(3月,6月,9月,12月) -Semi_Annual:仅启用(6月,12月) -年度:仅启用(十二月)
问题是该行为未正确完成,例如,如果我在选择semi_annual之后选择了Quarter,则发现Mar和Sep仍处于禁用状态。 这是我的代码:
<af:selectOneChoice value="#{bindings.FrequencyId.inputValue}"
required="#{bindings.FrequencyId.hints.mandatory}" id="soc2"
autoSubmit="true"
valueChangeListener="#{pageFlowScope.Bean.onChangeFrequency}">
<f:selectItems value="#{bindings.FrequencyId.items}" id="si2"/>
<f:validator binding="#{bindings.FrequencyId.validator}"/>
</af:selectOneChoice>
这是onChangeFrequency方法
private final String QUARTER_FREQ_MONTHS = "jan feb apr may jul aug oct nov";
private final String SEMI_ANNUAL_MONTHS = "jan feb mar apr may jul aug sep oct nov";
private final String ANNUAL = "jan feb mar apr may jun jul aug sep oct nov";
public void onChangeFrequency(ValueChangeEvent valueChangeEvent)
{
setDisabledMonthes("");
if (((Number) valueChangeEvent.getNewValue()).equals(new oracle.jbo.domain.Number(1))) {
disabledMonthes = QUARTER_FREQ_MONTHS;
} else if (((Number) valueChangeEvent.getNewValue()).equals(new oracle.jbo.domain.Number(2))) {
disabledMonthes = SEMI_ANNUAL_MONTHS;
} else {
disabledMonthes = ANNUAL;
}
AdfFacesContext.getCurrentInstance().addPartialTarget(getStartDateInputDateComp());
}
这是af:inputDate字段的代码:
<af:inputDate value="#{bindings.StartDate.inputValue}" label="#{createkpiuiBundle.START_DATE_LABEL}"
disabled="#{pageFlowScope.Bean.disabledMonthes eq ''}"
required="#{bindings.StartDate.hints.mandatory}" id="id4"
valueChangeListener="#{pageFlowScope.Bean.onChangeStartDate}"
autoSubmit="true"
disabledMonths="#{pageFlowScope.Bean.disabledMonthes}" partialTriggers="soc2"
binding="#{pageFlowScope.Bean.startDateInputDateComp}">
<f:validator binding="#{bindings.StartDate.validator}"/>
</af:inputDate>