Validating 3 fields

4 posts, 0 answers
  1. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 03 Apr 2015 Link to this post

    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

     

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 07 Apr 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Bilal
    Bilal avatar
    109 posts
    Member since:
    Oct 2014

    Posted 14 Apr 2015 in reply to Alexander Popov Link to this post

    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

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 16 Apr 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready