title: Using a4j:support's onchange event with h:selectOneMenu
body: <pre><code>&lt;h:selectOneMenu id="selectOneMenu"  value="#{Bean1.val1}" &gt;
      &lt;f:selectItems value="#{Bean1.selectItems}"/&gt;
      &lt;a4j:support event="onchange" action="#{Bean1.onSelectOneMenuChange}" reRender="textbox1 , textbox2 , textbox3, textbox4"  /&gt;
   &lt;/h:selectOneMenu&gt;
  
  &lt;h:inputText id="textbox1" value="#{Bean1.textbox1}"&gt; &lt;/h:inputText&gt;
  &lt;h:inputText id="textbox2" value="#{Bean1.textbox2}"&gt; &lt;/h:inputText&gt;
  &lt;h:inputText id="textbox3" value="#{Bean1.textbox3}"&gt; &lt;/h:inputText&gt;
  &lt;h:inputText id="textbox4" value="#{Bean1.textbox4}"&gt; &lt;/h:inputText&gt;
  </code></pre>
  
  <p><code>Bean1.onSelectOneMenuChange()</code> will change the value of <code>Bean1.textbox1</code>, <code>Bean1.textbox2</code>,<code>Bean1.textbox3</code> and <code>Bean1.textbox4</code>(depending on the value selected <code>(Bean1.val1)</code>). Sometimes, it will change all the textbox value and sometimes it will only changes some textbox value.</p>
  
  <p>When users change the value in the "selectOneMenu" drop down list control , the JSF framework will not call the update model values phase but call the <code>Bean1.onSelectOneMenuChange()</code> directly. After that, the all the textbox are reRender. Because the update model values phase is not called, the values entered by the user is never set the the Bean1 and the original value is shown in the textbox after <code>reRender</code>. </p>
  
  <p>I want to ask:</p>
  
  <ol>
  <li><p>How can I manually call the update model values phase inside <code>Bean1.onSelectOneMenuChange()</code>? How can I get the value input input by the users inside <code>Bean1.onSelectOneMenuChange()</code> and set it to the corresponding fields of the <code>Bean1</code>?</p></li>
  <li><p>Another approach is that only reRender those textbox whose values are updated inside the Bean1.onSelectOneMenuChange() .However , there are many case . For example, a value will change all the textbox value and a values may only change some textbox value.How can I <code>reRender</code> conditionally?  What method is more prefer for maintainability?</p></li>
  </ol>
  
  <p>Update :</p>
  
  <p>For point 2 , I find that the reRender preperties of the  can accept the EL expression , so I tried to use</p>
  
  <pre><code> &lt;a4j:support event="onchange"  action="#{Bean1.onSelectOneMenuChange}" reRender="#{Bean1.reRenderIDList}"  /&gt; .
  </code></pre>
  
  <p>Inside the  Bean1.onSelectOneMenuChange(), I set the Bean1.reRenderIDList to a set of ID that required to be reRender based on the business requirement.  The <code>Bean1.getRenderIDList()</code> runs when the page is refresh. However, when I change the value of <code>&lt;h:selectOneMenu&gt;</code> in the UI , Bean1.getRenderIDList() will never run again. Thus, the textbox cannot be <code>reRender</code>?</p>
  
  <p>Any idea?</p>