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

Validating 3 fields

3 Answers 44 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Bilal
Top achievements
Rank 2
Bilal asked on 03 Apr 2015, 09:40 PM

Hi,

 I am trying to build a custom validator to validate 3 fields: Min < Most Likely < Max.

 I've written this custom validator, but for some reason, most of the time, the value of "Max" is being read as null and no error messages are displayed. Is there something wrong with my code: 

http://dojo.telerik.com/@bhaidar/uvOfA

 Thanks,

Bilal

 

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 07 Apr 2015, 11:40 AM
Hello Bilal,

This happens only when the the validation rule is triggered by a change in the Mid input, which is expected. I am not sure what exactly the expected behavior is, however you could try calling the validate method each time a NumericTextBox is modified, as shown here.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bilal
Top achievements
Rank 2
answered on 14 Apr 2015, 08:36 AM

Hi,

The idea is to always make sure that Min is < Med and Med is < Max. Shall I write the validator in a different way? Or, you think calling the validate function every time Min, Med and Max values change would do the job?

 

Thanks

0
Alexander Popov
Telerik team
answered on 16 Apr 2015, 07:01 AM
Hello Bilal,

You can try splitting the logic into three rules, each checking only a single input at a time. Calling the validate method is optional of course, but it will help you validate all inputs immediately, no matter which one has changed.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Validation
Asked by
Bilal
Top achievements
Rank 2
Answers by
Alexander Popov
Telerik team
Bilal
Top achievements
Rank 2
Share this question
or