11 Replies Latest reply on Sep 6, 2007 5:09 AM by tkalactomo

    Tabs and required fields?

      Hy!
      On first tab i have some input texts which are required to have some value.
      The behaviour that I'm interested in is: how to prevent validation of those fields
      on switching tab's.So validation should occur only on full page submit or on
      some event on a4j:support inside tose required fields.

        • 1. Re: Tabs and required fields?

          There is the fixed version with a similar bug.
          How version are you use? Try the RF version 3.1.0 RC4.

          • 2. Re: Tabs and required fields?

             

            "akira_ag" wrote:
            There is the fixed version with a similar bug.
            How version are you use? Try the RF version 3.1.0 RC4.

            I'm using RichFaces 3.1.0. SNAPSHOT which is built this morning from svn.

            • 3. Re: Tabs and required fields?

              I have udated to latest binary distribution as announced:

              Binary Distribution:
              http://snapshots.jboss.org/maven2/org/richfaces/ui/richfaces-ui/3.1.0-rc4/richfaces-ui-3.1.0-rc4-bin.zip

              but still getting the same result.
              Can someone help?

              • 4. Re: Tabs and required fields?

                I'd have the similar forms and tabs in my applications and haven't the validation problems.
                Can you try to show this on simple example?
                I have the following:

                <rich:tabPanel id="tblPnl" binding="#{MySessionBean.myPanel}">
                 <rich:tab label="TestLabel1" id="TestTab1">
                 <h:form id="TestForm1">
                 <h:inputText id="testRequiredField" value="#{MySessionBean.testRequiredField}" required="true"/>
                 </h:form>
                 </rich:tab>
                 <rich:tab label="TestLabel2" id="TestTab2">
                 ...
                 </rich:tab>
                </rich:tabPanel"
                


                When a user clicked on TestLabel2 I don't see any validation errors when testRequiredField is not present.


                • 5. Re: Tabs and required fields?

                   

                  "akira_ag" wrote:
                  I'd have the similar forms and tabs in my applications and haven't the validation problems.
                  Can you try to show this on simple example?
                  I have the following:

                  <rich:tabPanel id="tblPnl" binding="#{MySessionBean.myPanel}">
                   <rich:tab label="TestLabel1" id="TestTab1">
                   <h:form id="TestForm1">
                   <h:inputText id="testRequiredField"
                   value="#{MySessionBean.testRequiredField}" required="true"/>
                   </h:form>
                   </rich:tab>
                   <rich:tab label="TestLabel2" id="TestTab2">
                   ...
                   </rich:tab>
                  </rich:tabPanel"
                  


                  When a user clicked on TestLabel2 I don't see any validation errors when testRequiredField is not present.

                  I'm sorry akira_ag.Perhaps I didn't explain it well.
                  I have two tabs.Tab panel is switchType="ajax".
                  Looks something like this(same as yours example):
                  <rich:tabPanel switchType="ajax">
                   <rich:tab label="First tab">
                   <h:form id="TestForm1">
                   <h:inputText id="testRequiredField" value="" required="true"/>
                   </h:form>
                   </rich:tab>
                   <rich:tab label="Second tab">
                  
                   </rich:tab>
                  </rich:tabPanel>
                  

                  I want to prevent the validation when user clicks on the second tab.
                  Because this behaviour is wizard-like.
                  So validation should only occur on full page submit or on
                  some event on a4j:support inside those required input fields fields,so user can freely surf through the richTab
                  component but on the
                  other hand can't make the changes to the entity until validation rules are met.

                  • 6. Re: Tabs and required fields?

                    Hmm... Can you try to remove switchType="ajax" and check this again?
                    There isn't any validation procedures for my first example.
                    If the validation occurs when ajax switch type is selected then this is a bug.

                    • 7. Re: Tabs and required fields?
                      nbelaevski

                      Hello!

                      Try to make tabs or tabPanel immediate, eg.:

                      <rich:tab immediate="true">
                      ...
                      


                      • 8. Re: Tabs and required fields?

                         

                        "nbelaevski" wrote:
                        Hello!

                        Try to make tabs or tabPanel immediate, eg.:
                        <rich:tab immediate="true">
                        ...
                        


                        Ok.I did that.But messages could not be rerendered
                        on a full page submit or on event which is called through a4j:support
                        inside component.
                        Is this surely not a bug?

                        <a:outputPanel ajaxRendered="true">
                         <r:panel bodyClass="panel">
                         <f:facet name="header">
                         <t:outputText value="#{messages['messages]}" />
                         </f:facet>
                         <t:messages errorClass="error" warnClass="warn"
                         infoClass="info" showSummary="true" showDetail="false"
                         summaryFormat="{1}: {0}" fatalClass="fatal" />
                         </r:panel>
                        </a:outputPanel>
                        




                        • 9. Re: Tabs and required fields?

                          I must point back to this problem.
                          Can someone help?

                          • 10. Re: Tabs and required fields?

                            are you sure the message exists?

                            • 11. Re: Tabs and required fields?

                              Apsolutelly.
                              Can you test it?
                              All code is in previous answers...