shared custom rules?

4 posts, 1 answers
  1. David
    David avatar
    17 posts
    Member since:
    Jul 2012

    Posted 03 Jan 2013 Link to this post

    hi,
    is it possible to trigger a custom rule for 2 input fields?
    for example i have 2 fields which are dependant on each other.  1 or the other is required.  but both can't not be empty.

    how would i do this?

    cheers
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 04 Jan 2013 Link to this post

    Hello David,

    Each custom rule will be run for each element in the validator form (docs). In other words you cannot run custom rule for two input fields at once - the rule will be triggered for each of them separately. If your requirement is to compare two fields, please select the other field with jQuery and check whether it is empty.

    Kind regards,
    Alexander Valchev
    the Telerik team
    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. David
    David avatar
    17 posts
    Member since:
    Jul 2012

    Posted 04 Jan 2013 Link to this post

    yes - thats possible - but doesn't remove the validation error.
    there are tricks to get around that i guess if its not possible such as forcing a hide + or trigging blur() on the fields i wish to validate
  5. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 08 Jan 2013 Link to this post

    Hello David,

    The validation messages can be hidden through jQuery hide method. For more information please check this forum topic.

    To select a specific message, you may use it's data-for attribute. As an example:
    $("span.k-tooltip-validation[data-for='inputName']");


    Regards,
    Alexander Valchev
    the Telerik team
    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