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

Unobtrusive Validation and Numeric Textbox

2 Answers 242 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 10 Jun 2013, 10:15 PM
Hi, I am new to the Kendo UI controls and am evaluating them for potential use in a new project. I am having difficulty getting unobtrusive validation to work for a numeric text box. On the same view, I am able to get unobtrusive validation to work for a Kendo date picker. I am at a loss to understand what I am missing from my MVC4 project. 

I have attached the source for my view, my model, my controller and the html output. I have also attached a screen grab of the unobtrusive validation working for the date picker and not the numeric text box.

Any help would be appreciated. Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 12 Jun 2013, 02:34 PM
Hello,

The most likely reason for the problem is that by default jquery.validate ignores hidden inputs. The problem can be avoided by overriding the validator default settings. Please check if adding the code in the snippet below after the validation scripts resolves the problem:

$.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
Scott
Top achievements
Rank 1
answered on 12 Jun 2013, 03:40 PM
Thanks Daniel. Your suggestion did the trick. I did however have to make sure that the call to setDefaults was done outside of the $(document).ready function in order to see the unobtrusive validation working as expected.  

Thanks again. Here also is a link on stack overflow that talks about this issue.

http://stackoverflow.com/questions/8466643/jquery-validate-enable-validation-for-hidden-fields
Tags
NumericTextBox
Asked by
Scott
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Scott
Top achievements
Rank 1
Share this question
or