3 Replies Latest reply on Apr 20, 2007 3:14 PM by klowtherjr

    Tabs with required fields

      I have a page with multiple tabs. Each tab has one or more required fields. The problem is that when a user submits the form from one tab, the other tabs validation kicks in requiring the fields from the "inactive" tab.

      I would like RichFaces to act like Tomahawk in this case (from where I just switched) and only validate the fields on the active tab. I am using the snapshot from yesterday (4/18/2007) as there was a fix in 3.0.1 that I needed to get to this point.

      I've tried a switch type of "ajax" and "client". However I don't think this is relevant as the problem is on the form submission, not on the tab switch.

        • 1. Re: Tabs with required fields

          Switch type is relevant because in case of "client" you will have full tab panes rendered and processed. Inactive tabs are just hidden, but fields are there and will be processed.
          However, you should expect that in case of "ajax" or "server" switch type inactive tabs will NOT be processed. If it not true, than we have one more bug. I remember that it was working as I describes just a few weeks ago, may be we can blame some resent changes.

          • 2. Re: Tabs with required fields

            I've tried it with "server", "ajax" and "client" and in the case of all three, I am taken back to the form on the other tab.

            Just to try something, I removed the wrapping form tag from around the rich:tabPanel just to see what would happen and it didn't make any difference whatsoever.

            If it helps, I upgraded to 3.0.1 from 3.0.0 to workaround this bug, which deals with tabs as well:
            http://jira.jboss.com/jira/browse/RF-26

            • 3. Re: Tabs with required fields

              Ok, I found a "workaround". Or perhaps I'm just starting to use it the way it was really inteneded. Fortunately, RichFaces doesn't work like Tomahawk in that we can embed forms within tabs. In Tomahawk (as of 1.1.5 Snapshot) you can't do that because it puts a form around the whole thing, thus nesting the forms. Anyway, once I realized I could do this, thanks to a few recent posts, it fell together and now I can validate and switch tabs independently using either "client" or "ajax". I didn't try "server", although I'm sure that probably works as well.

              Thanks for the help here folks.