0

I have created this valueChangeListener for a selectOneMenu in JSF:

<a4j:region>
   <a4j:repeat>
       <label class="select">
         <h:selectOneMenu id="onlyThis" value="#{bean.prio}"
            valueChangeListener="#{bean.prioChangeListener}" >
              <f:selectItems value="#{bean.prioSelectItems}" />
          </h:selectOneMenu> 
       </label>
    </a4j:repeat>
 </a4j:region>

I don´t understand the reason, why this valueChangeListener won´t be executed, if an another value was select in ths xhtml page.

Is there a mistake in my code? The Beans are declared in the right way

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40

1 Answers1

5

It's only executed when the form is submitted, not when you change the value:

So, either add a submit button and press it (you can also use <a4j:commandXxx> ones if necessary):

<h:commandButton value="Submit" />

Or throw in some ajax magic to automatically submit the form on change. As you're apparently on RichFaces 3.x, use <a4j:support>:

<h:selectOneMenu ...>
    <a4j:support event="onchange" />
</h:selectOneMenu>

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555