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

MVC unobtrusive validation doesn't work

4 Answers 947 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Andrii
Top achievements
Rank 1
Andrii asked on 29 May 2013, 03:37 PM
Hi! We are using in project Jquery Unobtrusive validation, but with kendo Dropdownlist validation doesn't work on client.

@(Html.Kendo().ComboBoxFor(model => model.CountryId)
      .Filter(FilterType.Contains)
      .BindTo(ViewBag.Countries)
      .HtmlAttributes(CommonHelpers.MergeHtmlAttributes(Html.GetUnobtrusiveValidationAttributes(
          CommonHelpers.GetPropertyName(() => Model.CountryId)),
          new Dictionary<string, object>(){
                          { "class", "combobox-country" }})))


How to fix this issue? Is it possible to combine Kendo Combobox and client-side mvc unobtrusive jquery validation?
Thanks!

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 May 2013, 10:27 AM
Hello,

A problem with the jQuery validation and the dropdownlist could occur if you are using jquery.validate 1.9+. By default it ignores hidden inputs and the dropdownlist uses one to hold the value. In order to enable the validation in this case you should override the validator default settings e.g.

$.validator.setDefaults({ ignore: '' });
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andrii
Top achievements
Rank 1
answered on 06 Jun 2013, 05:03 AM
Thanks! And now doesn't work only cascade controls (dropdowns, comboboxes) - when they are disabled((((
Do you know how to fix it?
Thanks!
0
Daniel
Telerik team
answered on 07 Jun 2013, 02:36 PM
Hello Andrii,

Disabled inputs should not be validated and there is no option that could be used to enable the validation.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andrii
Top achievements
Rank 1
answered on 07 Jun 2013, 03:27 PM
Hmm.. guys, i'm confused. Because Kendo UI controls i can't validate, always i must to write "shit"  in my code.
Tags
DropDownList
Asked by
Andrii
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Andrii
Top achievements
Rank 1
Share this question
or