2 Replies Latest reply on Jan 29, 2010 3:13 PM by W K

    rich:simpleTogglePanel validation issue

    W K Newbie

       

      I've been using rich:simpleTogglePanel fairly extensively in ajax mode until I realized that this wouldn't work well with required fields. Since the components in the toggle panel aren't validated when the panel is closed, you can end up with bad data in your backing bean. This is what I would expect with ajax or server mode though so I decided to switch to client mode. Validation does fire in client mode, though it does so in an incosistent manner. With the example below, running with RichFaces 3.2.2 I get the following behaviour:

      Steps (starting with open panel):

      1. Click Save - validation

      2. Close Panel

      3. Client Save - no validation

      4. Click Save - validation

       

       

      Has anyone seen this below or had to address validation issues with rich:simpleTogglePanel. I like the look/feel/behaviour of this component and I don't want to have to switch to a non-RichFaces (i.e. stricly js) solution.

       

      {code:xml}

      <a4j:form id="mainForm">

      <rich:messages/>

           <rich:simpleTogglePanel id="tg2" switchType="client" immediate="true" label="Client" opened="true">

           <f:facet name="closeMarker">

           Hide

           </f:facet>

           <f:facet name="openMarker">

           Show

           </f:facet>             

              <h:inputText id="codeC" required="true" value="#{togglePanel.codeC}"/>

           </rich:simpleTogglePanel>

           <h:commandButton id="save" action="#{togglePanel.save}" value="Save"/>

      </a4j:form>

      {code:xml}