0 Replies Latest reply on Oct 24, 2007 11:05 AM by Casey Boyd

    tabPanel, tab, switch Type Client question

    Casey Boyd Novice

      I have a tab panel with 2 tabs.

      1 tab is a group of required input boxes.

      The other tab is 2 data tables. The user can click on a record in one table and it will be moved to the other table. Kinda like a list of available records and selected records.

      After all of that, there is a commandButton that takes all this data and saves it to the database.

      Everything works great except for 1 thing....the required input boxes...

      What I want is when the user hits the button, to go to the tab that has validation errors.

      If I am on tab 2 and click update, I want it to go to tab one if some of the input boxes are not filled in.

      I almost get this functionality with the required="true" on tab one. If I add this and go to tab 2 and try to update, the user is taken back to tab 1 and errors are displayed.

      But, if I go to tab 2 and click on a record in the data table and then hit update....it doen't take me back to tab 1 if there are errors. Its almost like the submit from the data table is messing it up...

      Here is the code....

      
       <a4j:commandButton id="btnUpdateRole" value="Update" action="#{rolemanager.updateRole}"></a4j:commandButton>
      
       <rich:tabPanel id="tplRoleInfo" switchType="client">
      
       <rich:tab label="General">
      
       <h:panelGrid columns="2" columnClasses="name, value">
      
       <h:outputText value="Name:" />
       <s:decorate>
       <h:inputText style="width: 130px;" required="true" value="#{rolemanager.selectedRole.name}">
       <s:validate/>
       </h:inputText>
       </s:decorate>
      
       <h:outputText value="Value:" />
       <h:outputText value="#{rolemanager.selectedRole.value}" id="iptSelvalue" />
      
       <h:outputText value="Description:" />
       <s:decorate>
       <h:inputTextarea rows="5" cols="45" required="true" value="#{rolemanager.selectedRole.description}" >
       <s:validate/>
       </h:inputTextarea>
       </s:decorate>
      
       </h:panelGrid>
      
       </rich:tab>
      
       <rich:tab label="Permissions">
      
       <h:panelGrid columns="2" columnClasses="top, top" >
      
       <h:panelGrid columns="1" columnClasses="top" width="400px">
      
       <rich:dataTable id="tblAvailablePermissions"
       var="varPermission"
       value="#{rolemanager.permissions}" >
      
       <a4j:support event="onRowClick" ajaxSingle="true" action="#{rolemanager.addPermission(varPermission)}" />
      
       <f:facet name="header">
      
       <rich:column breakBefore="true">
       <h:outputText value="Name" />
       </rich:column>
      
       </f:facet>
      
       <rich:column><h:outputText value="#{varPermission.name}" /></rich:column>
      
       </rich:dataTable>
      
       </h:panelGrid>
      
       <h:panelGrid columns="1" columnClasses="top" width="400px">
      
       <rich:dataTable id="tblSelectedPermissions"
       var="varNewPermission"
       value="#{rolemanager.selectedRole.permissions}">
      
       <a4j:support event="onRowClick" ajaxSingle="true" action="#{rolemanager.removePermission(varNewPermission)}" />
      
       <f:facet name="header">
      
       <rich:column breakBefore="true">
       <h:outputText value="Name" />
       </rich:column>
      
       </f:facet>
      
       <rich:column><h:outputText value="#{varNewPermission.name}" /></rich:column>
      
       </rich:dataTable>
      
       </h:panelGrid>
      
       </h:panelGrid>
      
       </rich:tab>
      
       </rich:tabPanel>