0 Replies Latest reply on Oct 25, 2007 10:21 AM by indyjones

    Check for errors on Tab and redirect user....

      I have are 2 tabs.

      They have required input boxes.

      If I leave tab one and the input boxes are blank, I want to be redirected to tab 1 with the errors displayed.

      Switch Type Client.

      I have tried many different ways, I am now firing off a method on the "ontableave" event when leaving tab one, the errors are displayed, but how do I force to stay on tab 1?

      I even have some javascript working to get the error....

      Code...

      <a4j:commandButton value="Update" action="#{rolemanager.updateRole}"></a4j:commandButton>
      
      <rich:tabPanel id="tplRoleInfo" switchType="client" >
      
       <rich:tab label="General/System" required="true">
      
       <a4j:support event="ontableave" ajaxSingle="true" action="#{rolemanager.tableave}" oncomplete="tabclose();" />
      
       <h:outputText value="Name02:" />
       <s:decorate>
       <h:inputText required="true" value="#{rolemanager.selectedRole.name}" id="iptSelname" >
       <s:validate/>
       </h:inputText>
       </s:decorate>
      
       </rich:tab>
      
       <rich:tab label="Permissions">
      
       ....
       </rich:tab>
      
      </rich:tabPanel>
      
      <script type="text/javascript">
      
       function tabclose(){
      
       alert("111");
      
       if (document.getElementById('frmRoleInfo:iptSelname') != null){
      
       alert("DUDE!!!");
       }
      
       }
      
      </script>