I am using JSF and PrimeFaces. While trying to use PrimeFaces component p:selectOneMenu I found some issue.
<h:form>
<p:panel header="Select an offer and the date for the report" style="margin-bottom: 10px">
<h:panelGrid columns="2" cellpadding="5px">
<p:outputLabel for="offer" value="Offer: "/>
<p:selectOneMenu id="offer" value="#{partnerSales.selectedOffer}" style="width: 200px;">
<p:ajax event="change" update="year" listener="#{partnerSales.onOfferChange}"/>
<f:selectItem itemLabel="Select an offer: " noSelectionOption="true" itemValue=""/>
<f:selectItems value="#{partnerSales.allOffers}"/>
</p:selectOneMenu>
<p:outputLabel for="year" value="Year: "/>
<p:selectOneMenu id="year" value="#{partnerSales.selectedYear}" style="width: 200px">
<p:ajax update="month"/>
<f:selectItem itemLabel="Select a year: " itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{partnerSales.years}"/>
</p:selectOneMenu>
<p:outputLabel for="month" value="Month: "/>
<p:selectOneMenu id="month" value="#{partnerSales.selectedMonth}" style="width: 200px">
<f:selectItem itemLabel="Select a month: " itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{partnerSales.months}"/>
</p:selectOneMenu>
</h:panelGrid>
<p:separator/>
<p:commandButton value="Send" actionListener="#{partnerSales.displayData}"/>
</p:panel>
</h:form>
So, I have a selectOneMenu component which has a several options. By the default first item is "Select an offer: " with a null value and its not used for selection. Moreover, I use listener to catch value changing to update next components. But, when I try to change the values nothing is going. But when I select the first item from dropdown menu listener prints that it was visited. Where is the mistake? I cannot understand such strange behavior)