Reputation: 127
When I am trying to insert a validator to a selectOneMenu element containing a ajax listener in JSF, the ajax listener begins to not working. The following is my JSF snipplet specific to issue I am talking:
<h:selectOneMenu id="metalCodes" converter="metalCodeConverter" required="true" requiredMessage="#{lang.metalStockIntroducing_metalCode_req_txt}" value="#{metalStockIntroducingProcessesBean.metal.metalCode}">
<f:selectItem itemLabel="Please select..." noSelectionOption="true" />
<f:selectItems value="#{metalStockIntroducingProcessesBean.metalCodesMenu}" />
<f:ajax listener="#{metalStockIntroducingProcessesBean.changeMetalType}" event="change" execute="metalCodes" render="metalTypesMenu" immediate="false"/>
<f:validator validatorId="densityValidator"/>
</h:selectOneMenu>
What would you friends recommend me to do in order to make the validator and ajax listener works collaborately in a h:selectOneMenu JSF element?
Upvotes: 1
Views: 1408
Reputation: 1109635
They ought to work fine together. The ajax listener method will only not be invoked when the validator threw an exception. Make sure that your validator isn't incorrectly doing that. Make sure that you're re-rendering the <h:message>
or <h:messages>
associated with the input component as well so that you get notified of any faces messages during an ajax request. Or at least read the server logs, any queued-but-not-displayed faces messages will be logged there.
Upvotes: 3