Validate only if the input field as data

2 posts, 0 answers
  1. Philip
    Philip avatar
    8 posts
    Member since:
    Mar 2017

    Posted 22 Mar Link to this post

    We want to validate only if the user has inputed any data into a form field. So basically no fields are required, but if for some reason they filled out the email address field we want to make sure it a valid address.

    How would we use the Validator in this use case in an MVVM pattern.

    Thanks in advance

  2. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    300 posts

    Posted 24 Mar Link to this post

    Hi Philip,

    You can use the Kendo UI Validator with a custom rule. I have modified the official demo of the validator to show you:

    http://dojo.telerik.com/erAPi

    Additionally, since you are using MVVM, you may find the below how-to article useful as well:

    http://docs.telerik.com/kendo-ui/controls/editors/validator/how-to/validator-in-mvvm

    Kind Regards,
    Alex Hajigeorgieva
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top