I have this code above which works perfectly when i select some of the items on him… The a4j:support works fine and rerender my another field correctly…
The problem is if i choose one item, and then i back to “noSelectionLabel”…
When i do this for some reason my a4j:support dont work, i dont get into my method “setarFormulario” and i dont rerender my another field…
<s:decorate template="layout/form.xhtml">
<ui:define name="label">Evento:</ui:define>
<h:selectOneMenu value="#{home.instance.evento}" required="true">
<s:selectItems value="#{eventoService.obterTodos()}" var="evento" label="#{messages[evento.nome]}" noSelectionLabel="#{messages['br.com.message.NoSelection']}" />
<s:convertEntity />
<a4j:support event="onchange" action="#{home.setarFormulario}" reRender="camposFormulario" ajaxSingle="true" />
</h:selectOneMenu>
</s:decorate>
How can i get into my method even if i select the noSelectionLabel? Then my home.instance.evento must be null.. or something like this…
Yor field
h:selectOneMenuis required then selectingnoSelectionLabelvalue will cause a validation error and if you had validation error, then theaction="#{home.setarFormulario}"would never be called.As a workaround you can set to true the attribute
hideNoSelectionLabelfor yours:selectItemsthen the noSelectionLabel will be hidden when a value is selected