In the example below, the converter works correctly when the form is submitted. However, when attempting to perform any actions in the event 'onchange', the value of type 'enum' is changed to null. After several attempts and research, using valueChangeListener, onchange = "submit()" and immediate = "true", nothing resolved.
Enum
public enum TipoGasCondicaoUsoPermeacao {
CONCENTRACOES("Concentrações"),
FUGACIDADES("Fugacidades"),
PRESSOES_PARCIAIS("Pressões parciais");
private String label;
private TipoGasCondicaoUsoPermeacao(String label) {
this.label = label;
}
/**
* @return the descricao
*/
public String getLabel() {
return this.label;
}
}
XHTML
<h:selectOneMenu value="#{condicaoUso.tipoGasCondicao}" required="false" styleClass="field_form medio">
<f:selectItems value="#{listaMB.tiposGasCondicoesUso}" id="itemTipoGas" />
<a4j:support event="onchange" oncomplete="dadosAlterados(true)" reRender="otherPanel" />
</h:selectOneMenu>
faces-config.xml
<converter>
<converter-for-class>java.lang.Enum</converter-for-class>
<converter-class>javax.faces.convert.EnumConverter</converter-class>
</converter>
The problem persisted until I used the property ajaxSingle="true" (default is 'false'), as shown below:
Magic?