Hi there!
I have a xhtml file that needs to call a method when a selection inside a h:selectOneMenu happens. I used actionListener on the a:support because I needed more power (e.g. to know from which UIComponent the event comes from).
The problem is that the method defined by the actionListener is never called at all.
I've tried to do that with valueChangeListener as well but I needed to verify if the user selects a non valid object (noSelecionLabel).
my xhtml:
(...) <h:outputText value="#{messages['gerenciarorcamento.label.cidadefrete']}"></h:outputText> <h:selectOneMenu value="#{orcamento.frete}" required="true" styleClass="azul11" enabledClass="azul11" > <s:selectItems value="#{freteDAO.fretes}" var="frete" label="#{frete.cidade.nome}" noSelectionLabel="#{messages['gerenciarorcamentos.label.semfrete']}"/> <a:support actionListener="#{gerenciarOrcamentos.selecionaFrete}" event="onchange" status="ajaxStatus" oncomplete="alert" reRender="panelInfoFrete"/> </h:selectOneMenu> (...)
(...) public void selecionaFrete(ActionEvent ae) { log.info("\n\nCOMPONENTE: "+((HtmlAjaxSupport)ae.getSource()).getParent()); log.info("\n\nSELECAO: "+(((HtmlAjaxSupport)ae.getSource()).getParent())); try{ Frete frete = (Frete)((UISelectItems)((HtmlAjaxSupport)ae.getSource()).getParent()).getValue(); log.info("SELECIONANDO FRETE"); }catch (Exception e) { log.info("Nao conseguiu transformar a linha em MateriaPrimaPerfil"); } } (...)
(...) public void selecionaFrete(ActionEvent ae); (...)
Put rich:message for this component.
It also will be usefull to use PhaseTracker to get info in console about JSF phases execution