1 Reply Latest reply on Oct 27, 2009 8:04 PM by lvdberg

    Unable to reRender on radio button change if another element is having validation in form

    pkatta
      Hi to all,
      I am new to jboss seam framework,
      I am trying to implement the followig,

      I am having 3 Radio Buttons,
      1. Men 2.Women 3. Organization

      Depending on the selection i want to render differnt elements in page.
      if user selects MEN or WOMEN it shoud display and Read Date of Birth.
      if user selects ORGANIZATION it should display and Read Date of Creation.
      its working fine only when there is no validations on other elements.(I am unable to put required as true on any elements in page)

      The code is

      <div class="textboxCont">
      <h:selectOneRadio layout="lineDirection" value="#{toevoeging.men}" >
      <a:support id="onblur" event="onchange" reRender="chart" />
      <f:selectItem itemLabel="Man" itemValue="MAN"/>
      <f:selectItem itemLabel="Women" itemValue="WOMEN"/>
      <f:selectItem itemLabel="Rechtspersoon" itemValue="ORGANIZATION"/>
      </h:selectOneRadio>
      </div>

      <a:outputPanel id="chart">
      <c:choose>
      <c:when test="#{toevoeging.aanvrager.geslacht eq 'ORGANIZATION'}">
      <div class="row">
      <div class="label">Date of Creation<h:outputText value="*" /></div>
      <div class="infoIcon"><img src="images/information.png" alt="info"/></div>
      <div class="textboxCont">
      <h:inputText id="oprichtingsDatum" value="#{toevoeging.dateOfCreation}" class="inputText" />
      </div>
      </div>
      </c:when>
      <c:otherwise>
      <div class="row">
      <div class="label">Date of Birth<h:outputText value="*" /></div>
      <div class="infoIcon"><img src="images/information.png" alt="info"/></div>
      <div class="textboxCont">
      <h:inputText id="geboortedatum" value="#{toevoeging.dateOfBirth}" class="inputText" />
      </div>
      </div>
      </c:otherwise>
      </c:choose>
      </a:outputPanel>

      <div class="row">
      <div class="label">User Name<h:outputText value="*" /></div>
      <div class="infoIcon"><img src="images/information.png" alt="info"/></div>
      <div class="textboxCont">
      <h:inputText value="#{toevoeging.userName}" class="inputText"/>
      </div>
      <br class="clear" />
      </div>


      The above code works fine.
      If i want to reder "Chart" id along with User Name as compulsary field then its not works when i put

      <h:inputText value="#{toevoeging.userName}" class="inputText" required="true"/>

      Please let me know what I am doing wrong in this.
      Give me the guidance for the same.
        • 1. Re: Unable to reRender on radio button change if another element is having validation in form
          lvdberg

          Dear Pravin,


          I see that you put your testvalue in toevoeging.men, so you should test in the c:when on the same value. Or are you storing the men value in another bean-attribute?


          It would be helpful if you send us the code of your bean so we can see what happens because ajax tries to validate the whole form at once, so there is something wrong there. Try first if it improves when you put the


          ajaxSingle="true"



          attribute in a:support. This prevents sending the whole form.




          Leo