Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Validation
posted

I have WinTab with 6 tabs.

Each tab has it's own user control.

I do not want the user to be able to switch tabs unless the current tab is successfully validated.  I do not see any server events to accomplish this.

Any suggestions on how to do this?

Parents
No Data
Reply
  • 24497
    posted

    Hi,

    There is no server option to do that. However, you may process and cancel event on client if fields are not field or have wrong values. Example:

    <script type="text/javascript">
    function
    UltraWebTab1_BeforeSelectedTabChange(oWebTab, oTab, oEvent)
    {
     
    var oldTab = oWebTab.getSelectedTab();
     
    if(oldTab.getIndex() == 0)
     {
       
    var text1 = oldTab.findControl("TextBox1");
       
    var text2 = oldTab.findControl("TextBox2");
       
    if(!text1 || !text2)
        {
            alert(
    "can not find fields in tab 0");
           
    return;
        }
       
    if(text1.value.length < 1 || text2.value.length < 1)
        {
           alert(
    "Text1:" + text1.value + " text2:" + text2.value);
           oEvent.cancel =
    true;
        }
     }
     
    if(oldTab.getIndex() == 1)
     {
       
    var text3 = oldTab.findControl("TextBox3");
       
    var text4 = oldTab.findControl("TextBox4");
        
    if(!text3 || !text4)
        {
          alert(
    "can not find fields in tab 1");
         
    return;
        }
       
    if(text3.value.length < 1 || text4.value.length < 1)
        {
          alert(
    "Text3:" + text3.value + " text4:" + text4.value);
          oEvent.cancel =
    true;
        }
     }
    }
    </script>

    <igtab:UltraWebTab ID="UltraWebTab1" runat="server">
      
    <ClientSideEvents BeforeSelectedTabChange="UltraWebTab1_BeforeSelectedTabChange" />
      
    <Tabs>
        
    <igtab:Tab Text="New Tab">
          
    <ContentTemplate>
            
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
         
    </ContentTemplate>
       
    </igtab:Tab>
       
    <igtab:Tab Text="New Tab">
          
    <ContentTemplate>
            
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            
    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
         
    </ContentTemplate>
      
    </igtab:Tab>
     
    </Tabs>
    </igtab:UltraWebTab>

Children