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

Form Validation does not work with Multiple tabs

5 Answers 151 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Reza
Top achievements
Rank 1
Reza asked on 16 Jul 2010, 09:33 PM
Hello there,

I'm using Telerik Tabstrip and Menu. Here is the scenario:

I have DataAnnotation validation on Models, let say "Region" and "Contact".
I've used on form tag which encompass the tabstip that contains two tabs one for "Region" and the other for "Contact" partial views. The goal is that when user click Save menu Item, it'll trigger validation of both partial views and send both Contact and Region to the controller action.

The binding model is working fine and in the controller action I get both Region and Contact objects, however client side validation does not work at all.
Loading Region and Contact partial views are not Ajax (though ajax version did not work on client validation either). Seeing the markup in the FireBug, shows that the script are in the markup but the validation does not work.

I appreciate your attention.

Thanks,
Reza

5 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 20 Jul 2010, 09:06 AM
Hello Reza,

I suppose that you forgot to call Html.EnableClientValidation into ascx file. For your convenience I have attached a simple test project which implements the required functionality. Check PostTabStrip.aspx page.

Best wishes,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kevin
Top achievements
Rank 1
answered on 29 Jul 2011, 08:01 PM
So I have a similar issue, so your answer looked promising.  There is one difference with my app.  My tabs are dynamically created so the partial view and the controls within it are all built on the fly.  Adding in Html.EnableClientValidation on the partial view didn't help.

Do I have to do something extra because the controls are dynamically added?

Steve
0
Henry
Top achievements
Rank 1
answered on 25 Aug 2011, 07:50 AM
I have the similar question. I'm using the razor engine, server side "Bind to" and "ContentUrl" like below:
@{Html.Telerik().TabStrip()
    .Name("TabStrip")
    .BindTo((IEnumerable<TapStripNavigationData>)ViewBag.TabStripData, (item, navigationData) => {
        item.Text = navigationData.Text;
        item.ImageUrl = navigationData.ImageUrl;
        item.ContentUrl = navigationData.ContentUrl;
    })
    .SelectedIndex(0)
    .Render();
}

The client side form validation in partial view doesn't work in TabStrip.
0
Henry
Top achievements
Rank 1
answered on 25 Aug 2011, 09:30 AM
Solved, please see my post: 

http://www.telerik.com/community/forums/aspnet-mvc/tabstrip/repost-client-validation-in-loadfromcontent.aspx#1776099
0
nachid
Top achievements
Rank 1
answered on 25 Aug 2011, 09:31 AM
When tabs are loaded dynamically you should explicitly reset validation by calling
if (jQuery.validator !== undefined)
{
    jQuery.validator.unobtrusive.parse('form');
}
Tags
TabStrip
Asked by
Reza
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Kevin
Top achievements
Rank 1
Henry
Top achievements
Rank 1
nachid
Top achievements
Rank 1
Share this question
or