You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by wk...@ebi.ac.uk on 2007/10/17 18:34:40 UTC

ValueChangeListener is executed three times...

Hi,

I have three different SelectOneMenu components with ValueChangeListeners.
Each ValueChangeListener calles the same method!

If you now change the value from one of the selectOneMenus all three
ValueChangeListener
will be called, so the processValueChangePosResult method is called three
times.

I tried it also with three different ValueChangeListener methods. But each
time you change
one of the selectOneMenu's values all three changeListeners will be called.

I suppose it depends on the onchange="submit()" method,  because it
appears in all three menus...

<h:selectOneMenu id="itemPosPicr"
                 rendered="#{currentData.renderedPicrPos}"
            valueChangeListener="#{siteChanger.processValueChangePosResult"
                 onchange="submit()"
          <f:selectItems value="#{currentData.itemPosPicr}"/>
</h:selectOneMenu>

public void processValueChangePosResult(ValueChangeEvent value) throws
IOException {

       String selectedValue = (String) value.getNewValue();
       System.out.print(selectedValue);
             FacesContext.getCurrentInstance().getExternalContext().redirect("http://www.google.de");
   }

Any suggestions?
Thanks!
Wolfgang