Hello all,
I have JSF page has two drop down lists and I want to load the second one with values based on what was chosen in the first one. However, the "onchange" event is only detected the second time I change the selection!
Web page Code snippet:
<h:form id="selectRegion">
<h:selectOneMenu id="governorate"
value="#{SearchView.governorate}"
styleClass="mediumInput" immediate="true"
valueChangeListener="#{SearchView.goverValueChanged}"
onchange="submit();">
<f:selectItems value="#{SearchView.goverItemsList}" id="govItems" />
</h:selectOneMenu>
<h:selectOneMenu id="district"
value="#{SearchView.district}"
styleClass="mediumInput">
<f:selectItems value="#{SearchView.districtItemsList}" id="distItems" />
</h:selectOneMenu>
</h:form>
<h:form id="SearchFor">
<hx:commandExButton
id="button1" styleClass="btn" type="submit"
value="Search" action="#{SearchView.searchAction}"
onclick="document.getElementById('selectRegion').submit();">
</hx:commandExButton>
</h:form>
The problem is that goverValueChanged(ValueChangeEvent event) is invoked only when I modify the value of the governorate for the second time but not for the first time (I put system out in goverValueChanged(ValueChangeEvent event) to know that).
Does anyone have an idea regarding what might be wrong? Thanks in advance! I am using JSF 1.1 and run on IBM WAS