6 Replies Latest reply on Sep 27, 2007 6:13 AM by Ilya Shaikovsky

    Validation using tabbed panel (w/Seam 2.0.0)

    Phil Haigh Novice

      Hi,

      I am using the tabbed panel from Richfaces 3.1.0 (and Seam 2.0.0), and cannot get validation to work properly. Anything that is required=true correctly validates, but any other validation is simply not fired - e.g. max/min length etc: the form is just allowed to submit and throws an error when attempting to persist to the DB.

      Validation works just fine on pages without the tabbed panel component.

      Is there a particular trick for using this combination of components, or is this a bug (and if so, in Seam or RF?)?

      cheers

      phil

        • 1. Re: Validation using tabbed panel (w/Seam 2.0.0)
          Phil Haigh Novice

          Interestingly, this only seems to affect <s:validateAll>... if I put <s:validate/> within a component, it works.

          So, to summarise:

          This doesn't work:

          <h:form>
           <f:facet name="afterInvalidField">
           <h:panelGroup><br/><s:message/></h:panelGroup>
           </f:facet>
           <f:facet name="aroundInvalidField">
           <s:span styleClass="error"/>
           </f:facet>
           <s:validateAll>
          
           <rich:tabPanel contentClass="tabbedpanel" switchType="client" selectedTab="#{customerManager.selectedTab}">
           <rich:tab label="General" name="General" >
           <h:outputText value="First name: "/>
           <s:decorate id="firstname">
           <h:inputText label="Customer first name" value="#{customer.firstName}" required="true">
           <a4j:support event="onblur" reRender="firstname" ajaxSingle="true"/>
           </h:inputText>
           </s:decorate>
           </rich:tab>
           </rich:tabPanel>
          </s:validateAll>
          
          </h:form>


          This does:

          <h:form>
           <f:facet name="afterInvalidField">
           <h:panelGroup><br/><s:message/></h:panelGroup>
           </f:facet>
           <f:facet name="aroundInvalidField">
           <s:span styleClass="error"/>
           </f:facet>
           <s:validateAll>
          
           <rich:tabPanel contentClass="tabbedpanel" switchType="client" selectedTab="#{customerManager.selectedTab}">
           <rich:tab label="General" name="General" >
           <h:outputText value="First name: "/>
           <s:decorate id="firstname">
           <h:inputText label="Customer first name" value="#{customer.firstName}" required="true">
           <a4j:support event="onblur" reRender="firstname" ajaxSingle="true"/>
           <s:validate/>
           </h:inputText>
           </s:decorate>
           </rich:tab>
           </rich:tabPanel>
           </s:validateAll>
          </h:form>
          


          Which leads me to suspect that this is in fact a bug.. although whether it's RichFaces or Seam I have no clue ;-)

          cheers

          phil

          • 3. Re: Validation using tabbed panel (w/Seam 2.0.0)
            Pete Muir Master

            I'm just reviewing the issue. I don't understand why tabPanel is an EditableValueHolder as there doesn't appear to any input going on with it.

            The spec says:

            EditableValueHolder is an extension of ValueHolder that describes additional features supported by editable components


            • 4. Re: Validation using tabbed panel (w/Seam 2.0.0)
              Ilya Shaikovsky Master

              And this features is valueChangeEvent and validation.

              As far as I see in UISwitchablePanel.java we've use the validation of the tab Panel.

              • 5. Re: Validation using tabbed panel (w/Seam 2.0.0)
                Pete Muir Master

                Ok, I took a look at the code. Where does the validator get used in UISwitchablePanel? Actually, I would guess it's actually to allow valuechangeevents to occur.

                In fact looking at UITabPanel, I guess this is because the selected tab is treated as the 'value' of the component which I guess is reasonable.

                • 6. Re: Validation using tabbed panel (w/Seam 2.0.0)
                  Ilya Shaikovsky Master

                  Yes and we use TabPanel as input which store selectedTab.