This is a migrated thread and some comments may be shown as answers.
Conditional errorTemplate
2 Answers 19 Views
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 03 Feb 2017, 01:59 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 07 Feb 2017, 09:18 AM
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.
0
James
Top achievements
Rank 1
answered on 08 Feb 2017, 03:22 PM
Thanks I think the CSS trick will do
Asked by
James
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
James
Top achievements
Rank 1
Share this question
or