0 Replies Latest reply on May 29, 2008 4:07 PM by Michael Imari

    cant get valueChangeListener to work with Seam

    Michael Imari Newbie

      Hi,


      I created a project and an entity 'myEntity' with seamgen. In the myEntity.xhml I added a h:selectOneMenu with a valueChangeListener. The valueChangeListener points to MyEntity or to MyEntityHome alternatively.


      But the valueChangeListener is never called.


      Any hints?


      Regards,


      Mika


      Environment:
      Java 1.5.0-15, jboss-seam-2.0.2.GA, JBoss-4.2.2.GA



      <s:decorate id="categoryDecoration" template="layout/edit.xhtml">
       <ui:define name="label">Category</ui:define>
       <h:selectOneMenu id="slCategory" value="#{myEntityHome.instance.category}"
       valueChangeListener="#{myEntityHome.onChangeCategory}">
      <f:selectItems value="#{myEntityHome.categories}" />
      </h:selectOneMenu>
      <f:verbatim>
       oder 
      </f:verbatim>
      
      <h:inputText id="tfCategory" required="true" value="#{myEntityHome.instance.category}" />
      
      </s:decorate>
      


      @Name("myEntityHome")
      public class MyEntityHome extends EntityHome<MyEntity> {
      ...
      public void onChangeCategory(ValueChangeEvent ev) {
        getInstance().onChangeCategory(ev);
      }
      ...
      



      @Entity
      public class MyEntity implements Serializable {
      ...
      
      public void onChangeCategory(ValueChangeEvent ev)
      throws AbortProcessingException {
       String s = (String) ev.getNewValue();
       category = s;
       System.out.println("Value Changed: " + s);
      }
      ...
      }