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

[Solved] ignore class not being applied in JQuery validation

2 Answers 21 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.
Jon Baron
Top achievements
Rank 1
Jon Baron asked on 06 Sep 2012, 05:48 PM
Hey all.

So I have a tabstip, loading content via AJAX (LoadContentFrom) and want to use JQuery validation. My validation must be dynamic, so I have all fields set to required via the annotation attribute. and Use the below function to 'ignore' the fields that shouldn't be required at the specific moment:
// Ignore those fields we don't want to validate
    $(function () {
        var settngs = $.data($('#tbTab2')[0], 'validator').settings;
        settngs.ignore = ".ignore1";
    });

This works exactly as intended on another tab, within the same tab strip. Unfortunately on another, with exact same coding, the validation always fires. ie, the fields are not 'ignored'. I've done an alert(settngs) and the validator object is there, and is not null.

Could really use some help on this one!

Thanks :)

2 Answers, 1 is accepted

Sort by
0
Jon Baron
Top achievements
Rank 1
answered on 06 Sep 2012, 06:03 PM
Hmm, well using:

jQuery.validator.defaults.ignore = ".ignore1";

Instead in the above function seems to have moved somewhat further but not all the way.
0
Daniel
Telerik team
answered on 12 Sep 2012, 06:46 AM
Hello Jon,

Setting the default options needs to be done before the validator is initialized in order for them to be applied. The approach to set the settings on the form validator object looks correct. Could you provide the full code you are using or a small runnable sample which demonstrates the problem so I can check the exact setup?

Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
TabStrip
Asked by
Jon Baron
Top achievements
Rank 1
Answers by
Jon Baron
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or