Conditional errorTemplate

3 posts, 1 answers
  1. Savas
    Savas avatar
    22 posts
    Member since:
    Nov 2015

    Posted 03 Feb Link to this post

    Hello,

    I am looking at doing remote validation using custom rules and I found http://www.telerik.com/blogs/extending-the-kendo-ui-validator-with-custom-rules approach which is exactly what I am looking for, however I would like to show a message using different styling/template when a field is in "checking.." state vs when there is an actual error, 

    Is there any way to specify an error template only for single field or conditionally change the error template based on for what field it is showing the error message, also I am using AngularJS version

     

    Thanks
    Ketul

     

     

  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1931 posts

    Posted 07 Feb Link to this post

    Hello Ketul,

    The errorTemplate cannot be defined on per input basis. You can create a custom rule that matches a single input only and provide a message of your choice for it, as shown in this code snippet.

    If you need to change the styling of the input while it is in the checking state, consider adding a custom CSS class to it when you enter the availability.check function (from the example in the blog post). Using this class, you can overwrite the default error style during the AJAX call only. In the AJAX request complete callback, you can remove this class from the input element, so the normal valid/invalid styles can kick in.

    Regards,
    Tsvetina
    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.
  3. Savas
    Savas avatar
    22 posts
    Member since:
    Nov 2015

    Posted 08 Feb in reply to Tsvetina Link to this post

    Thanks I think the CSS trick will do
Back to Top