6 Replies Latest reply on Sep 17, 2009 8:45 AM by Naresh Bhatia

    Showing/Hiding controls using a radio button

    Naresh Bhatia Novice

      What's the best way to show/hide controls using a radio button.? Here's my attempt:

      <h:form id="transferForm">
       <h:selectOneRadio id="transferKind" value="#{transferKinds}">
       <s:selectItems value="#{transferKinds}" var="transferKind"
       label="#{transferKind}" />
       <s:convertEnum />
       <a4j:support id="onchange" event="onchange" />
       </h:selectOneRadio>
      
       <a4j:outputPanel id="transferFields" layout="block"
       rendered="#{transferController.cashTransfer}">
       <h:inputText id="amount" required="true" styleClass="wideText"
       value="#{transferController.amount}">
       </h:inputText>
       </s:decorate>
       </a4j:outputPanel>
      
       ...
      </h:form>
      


      This is not really working. Although I have a "rendered" attribute on the output panel, it is always being shown - it never hides. In addition, when the radio button is hit, it does a full form validation and starts showing errors on the empty fields. Is there a better approach?