This is a migrated thread and some comments may be shown as answers.

Validation tabs

2 Answers 98 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 15 Jun 2011, 12:02 PM
Hello,

I'm struggling with the individual validation of my tabs. I browser the internet and the telerikforums but i wom't get it to work.

I have the following tabstrip :

<telerik:RadTabStrip ID="tabManagement" runat="server" MultiPageID="mpManagement"
                SelectedIndex="0" CausesValidation="true" OnClientTabSelected="UpdateValidationGroup">
                <Tabs>
                    <telerik:RadTab Text="Algemeen" Value="Algemeen">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Contactpersoon" Value="Contactpersoon">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Adresgegevens" Value="Adresgegevens">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Openingstijden" Value="Openingstijden">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Winkelpagina" Value="Winkelpagina">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Instellingen webshop" Value="InstellingenWebshop">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Google" Value="Google">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Statistieken" Value="Statistieken">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Account" Value="Account">
                    </telerik:RadTab>
                </Tabs>
 </telerik:RadTabStrip>

On the clientevent TabSelected I run the script:
function UpdateValidationGroup(tabStrip, eventArgs) {

        var selectedTab = tabStrip.get_selectedTab();
        if (selectedTab != null) {
            tabStrip.ValidationGroup = selectedTab.get_value();
        }
    } 

I use the Value-property of the selectedtab to set the validationgroup. That works fine. The validationgroup of validationcontrols in the RadPageViews have the same name as the Value-property of the selected tab. In my tab itself the validation fires but I can still navigate to another tab even when validation is false. What I want is that I cannot navigate to another tab as long as one of my validators in my selected tab is false.

When I hardcode the validationgroup of my TabStrip then it works fine.

Can anyone tell me what I'm doing wrong.

Thx

Patrick

2 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 15 Jun 2011, 05:38 PM
Hello Patrick,

Try using this way to set the validation group:

function UpdateValidationGroup(tabStrip, eventArgs) {
  
        var selectedTab = tabStrip.get_selectedTab();
        if (selectedTab != null) {
            tabStrip.set_validationGroup(selectedTab.get_value());
        }
    }

Hopefully that sets the ValidationGroup the right way.
0
Patrick
Top achievements
Rank 1
answered on 16 Jun 2011, 07:40 AM
Thanks! That did the trick!
Tags
TabStrip
Asked by
Patrick
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Patrick
Top achievements
Rank 1
Share this question
or