title: Richfaces and JSF/AJAX Lifecycles
body: <p>I´ve managed to get the code to do what I intended, but I do not understand a particular aspect of why this works.  I´m running Seam 2.2.2 with Richfaces 3.3.3.</p>
  
  <p>Here is the code from the xhtml page:</p>
  
  <pre><code>...
  &lt;h:form id="radiobuttontestform"&gt;
  
      &lt;fieldset&gt;           
          &lt;h:panelGrid columns="3"&gt;
  
              &lt;h:selectOneRadio layout="pageDirection" id="myRadio" value="#{actionBean.myRadioButton}"&gt;
                  &lt;f:selectItem itemLabel="First" itemValue="0" /&gt;
                  &lt;f:selectItem itemLabel="Second" itemValue="1" /&gt;
                  &lt;a4j:support event="onclick" ajaxSingle="true" process="myDropdown" reRender="myDropdown,myCount,test" /&gt;
              &lt;/h:selectOneRadio&gt;
            &lt;h:panelGrid columns="1" border="0"&gt;
              &lt;h:selectOneListbox size="1" id="myDropdown" value="#{actionBean.rowCountPredefined}" disabled="#{actionBean.myRadioButton != '0'}"&gt;
                  &lt;f:selectItem itemLabel="10" itemValue="10" /&gt;
                  &lt;f:selectItem itemLabel="20" itemValue="20" /&gt;
                  &lt;f:selectItem itemLabel="30" itemValue="30" /&gt;
              &lt;/h:selectOneListbox&gt;
  
              &lt;h:inputText id="myCount" maxlength="5" value="#{actionBean.rowCountSpecified}" disabled="#{actionBean.myRadioButton != '1'}" required="true"&gt;
                  &lt;f:validateLongRange minimum="1" maximum="1000" /&gt;
                  &lt;rich:ajaxValidator event="onkeyup" for="myCount" /&gt;
              &lt;/h:inputText&gt;
              &lt;rich:message id="errorMessage" for="myCount" ajaxRendered="true" showDetail="false" showSummary="true"&gt;
                  &lt;f:facet name="errorMarker"&gt;ERROR:&lt;/f:facet&gt;
              &lt;/rich:message&gt;
         &lt;/h:panelGrid&gt;
  
      &lt;/h:panelGrid&gt;
      &lt;/fieldset&gt;
      &lt;h:outputLabel id="test" value="RadioValue: #{actionBean.myRadioButton}" /&gt;
  
      &lt;a4j:commandButton id="show" value="Show Values in Log" action="#{actionBean.showValues}" /&gt;
      &lt;a4j:commandButton id="done" value="Save and end conversation" action="#{actionBean.apply}" /&gt;
  &lt;/h:form&gt;
  ...
  </code></pre>
  
  <p>The backing bean is just a simple POJO with getters and setters for the three properties here. (myRadioButton, rowCountPredefined, rowCountSpecified)</p>
  
  <p>This is what I get: (the correct result)</p>
  
  <p><a href="http://katzekat.de/Bilder/radio2.png" rel="nofollow noreferrer">radio button example http://katzekat.de/Bilder/radio2.png</a></p>
  
  <p><a href="http://katzekat.de/Bilder/radio.png" rel="nofollow noreferrer">radio button example http://katzekat.de/Bilder/radio.png</a></p>
  
  <p>Here is my thinking:</p>
  
  <p>Setting ajaxSingle to true means that only the radio button will be processed on the server.  The dropdown next to it doesn´t need validation - it will always contain a correct value.  I´ve added the process="myDropdown" in order to persist the value into the backing bean, otherwise when I switch the radio button to position 2 the dropdown reverts to its original value. (I realise this is only cosmetic!) I´ve checked this with a debugger and it does indeed set the property in the backing bean and everything is working as expected.</p>
  
  <p>Once the radio button is switched into position 2 a value can be entered in the textbox and will be validated.  This works perfectly, and when I switch the radio button back to position 1, the validation error is cleared if this field is in an error state.  Presumably because the error message is only present in the request scope.</p>
  
  <p>Firing up the debugger again when the radio button is in position 2 and entering a valid value in the text field reveals no update on the backing bean when switching back to position 1.  I also expected this as I´m telling only the radio and the dropdown to process on the server.  This is the bit I don´t understand though - the value in the textfield <em>is</em> persisted on postback. (See 2nd link above) Where is this value for this textfield saved if not in the backing bean ?</p>