MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-543

The wrong tab may be displayed after a validation failure and serverSiteTabSwitch="false"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.1.3
    • Fix Version/s: None
    • Component/s: Tabbed Pane
    • Labels:
      None

      Description

      I have a form on a tabbed pane that validates input. When their is a validation error and the attribute serverSideTabSwitch on <t:panelTabbedPane> is undefined or set to false, the first tab is displayed, not the one with the error.

      Their is a selectedIndex attribute on <t:panelTabbedPane>. I would contend that the selectIndex is not getting
      set/restored when serverSiteTabSwitch="false". This show up when the validation phase fails.

      Or said another way:
      MyFaces does not know which tab the clicked button was on and it always display the tab
      identified by selectIndex when serverSiteTabSwitch="false" when their is a validation failure.

      The code below will demonstrate the problem. Click on "Server Tab 2" then "Submit Query". "Server Tab 2"
      is still the current table. Now do the same with "Client Tab 2". You will notice that "Client Tab 1" is
      the current tab!

      <t:panelTabbedPane id="serverSideSwitch" width="100%" serverSideTabSwitch="true">
      <t:panelTab label="Server Tab 1">
      <h:form>
      <h:outputLabel for="tab_1_input" value="Required Value" />
      <h:inputText id="tab_1_input" required="true" />
      <h:commandButton action="submit" />
      <h:messages />
      </h:form>
      </t:panelTab>
      <t:panelTab label="Server Tab 2">
      <h:form>
      <h:outputLabel for="tab_2_input" value="Required Value" />
      <h:inputText id="tab_2_input" required="true" />
      <h:commandButton action="submit" />
      <h:messages />
      </h:form>
      </t:panelTab>
      </t:panelTabbedPane>
      <t:panelTabbedPane id="clientSideSwitch" width="100%" serverSideTabSwitch="false">
      <t:panelTab label="Client Tab 1">
      <h:form>
      <h:outputLabel for="ctab_1_input" value="Required Value" />
      <h:inputText id="ctab_1_input" required="true" />
      <h:commandButton action="submit" />
      <h:messages />
      </h:form>
      </t:panelTab>
      <t:panelTab label="Client Tab 2">
      <h:form>
      <h:outputLabel for="ctab_2_input" value="Required Value" />
      <h:inputText id="ctab_2_input" required="true" />
      <h:commandButton action="submit" />
      <h:messages />
      </h:form>
      </t:panelTab>
      </t:panelTabbedPane>

        Issue Links

          Activity

          Hide
          Leonardo Uribe added a comment -

          The example provided will never work, since it uses several h:form per each tab. so when there is a click on one the other state get lost.

          But if is used t:subform it works!.

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
          <title>Insert title here</title>
          </head>
          <body>
          <f:view>
          <h:form>
          <t:panelTabbedPane id="serverSideSwitch" width="100%" serverSideTabSwitch="true">
          <t:panelTab label="Server Tab 1">
          <t:subform>
          <h:outputLabel for="tab_1_input" value="Required Value" />
          <h:inputText id="tab_1_input" required="true" />
          <h:commandButton action="submit" />
          <h:messages />
          </t:subform>
          </t:panelTab>
          <t:panelTab label="Server Tab 2">
          <t:subform>
          <h:outputLabel for="tab_2_input" value="Required Value" />
          <h:inputText id="tab_2_input" required="true" />
          <h:commandButton action="submit" />
          <h:messages />
          </t:subform>
          </t:panelTab>
          </t:panelTabbedPane>
          <t:panelTabbedPane id="clientSideSwitch" width="100%" serverSideTabSwitch="false">
          <t:panelTab label="Client Tab 1">
          <t:subform>
          <h:outputLabel for="ctab_1_input" value="Required Value" />
          <h:inputText id="ctab_1_input" required="true" />
          <h:commandButton action="submit" />
          <h:messages />
          </t:subform>
          </t:panelTab>
          <t:panelTab label="Client Tab 2">
          <t:subform>
          <h:outputLabel for="ctab_2_input" value="Required Value" />
          <h:inputText id="ctab_2_input" required="true" />
          <h:commandButton action="submit" />
          <h:messages />
          </t:subform>
          </t:panelTab>
          </t:panelTabbedPane>
          </h:form>
          </f:view>
          </body>
          </html>

          So it is not a bug of the component, and no further advance could be done here.

          I'll close this issue as invalid.

          There is an issue about selectIndex (TOMAHAWK-858), but this will be solved (if is possible) there.

          Show
          Leonardo Uribe added a comment - The example provided will never work, since it uses several h:form per each tab. so when there is a click on one the other state get lost. But if is used t:subform it works!. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <f:view> <h:form> <t:panelTabbedPane id="serverSideSwitch" width="100%" serverSideTabSwitch="true"> <t:panelTab label="Server Tab 1"> <t:subform> <h:outputLabel for="tab_1_input" value="Required Value" /> <h:inputText id="tab_1_input" required="true" /> <h:commandButton action="submit" /> <h:messages /> </t:subform> </t:panelTab> <t:panelTab label="Server Tab 2"> <t:subform> <h:outputLabel for="tab_2_input" value="Required Value" /> <h:inputText id="tab_2_input" required="true" /> <h:commandButton action="submit" /> <h:messages /> </t:subform> </t:panelTab> </t:panelTabbedPane> <t:panelTabbedPane id="clientSideSwitch" width="100%" serverSideTabSwitch="false"> <t:panelTab label="Client Tab 1"> <t:subform> <h:outputLabel for="ctab_1_input" value="Required Value" /> <h:inputText id="ctab_1_input" required="true" /> <h:commandButton action="submit" /> <h:messages /> </t:subform> </t:panelTab> <t:panelTab label="Client Tab 2"> <t:subform> <h:outputLabel for="ctab_2_input" value="Required Value" /> <h:inputText id="ctab_2_input" required="true" /> <h:commandButton action="submit" /> <h:messages /> </t:subform> </t:panelTab> </t:panelTabbedPane> </h:form> </f:view> </body> </html> So it is not a bug of the component, and no further advance could be done here. I'll close this issue as invalid. There is an issue about selectIndex ( TOMAHAWK-858 ), but this will be solved (if is possible) there.
          Hide
          Leonardo Uribe added a comment -

          woops! my mistake. This is not a duplicate. I'll try to reproduce it.

          Show
          Leonardo Uribe added a comment - woops! my mistake. This is not a duplicate. I'll try to reproduce it.
          Hide
          Leonardo Uribe added a comment -

          This issue is a duplicate of TOMAHAWK-717, so since it was solved, this will be closed as well.

          Show
          Leonardo Uribe added a comment - This issue is a duplicate of TOMAHAWK-717 , so since it was solved, this will be closed as well.
          Hide
          Alex Alvarez added a comment -

          I have noticed that for some strange reason when the state is serialised/deserailised JspStateManagerImpl the Integer containing the current tab misteriously disappears.

          Show
          Alex Alvarez added a comment - I have noticed that for some strange reason when the state is serialised/deserailised JspStateManagerImpl the Integer containing the current tab misteriously disappears.

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Paul Spencer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development