This is a migrated thread and some comments may be shown as answers.

How to exclude HTML tags for Kendo Editor length validation?

1 Answer 274 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vinod
Top achievements
Rank 1
Vinod asked on 26 Sep 2014, 03:31 PM
Hello,

I am using a Kendo Grid popup which displays a Kendo editor to modify the content of the field. The field is configured on the MVC server side with the annotation to validate length to be 500 characters as follows:

[AllowHtml]
[StringLength(500, ErrorMessageResourceName = "ActionMaxLength", ErrorMessageResourceType = typeof(Resources.Messages))]
public string Action { get; set; }

If the user enters more than 500 characters in the Kendo editor this validation works. However, our users reported that when they added more formatting (tables, bullet lists) the validation pops up even if the visible character count is not 500. I understand from a technical perspective the character count being validated includes the behind-the-scenes html formatting tags, however this is not intuitive to the end user.

My question is, is there any alternative or built in approach to validate just the html-stripped character count of the Kendo editor validation?

Regards,
V. Joseph


1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 29 Sep 2014, 08:08 AM
Hello Vinod,

In order to achieve this, you may want to create a custom validation attribute and enable remote validation, like shown in this tutorial. You can strip HTML tags via this regular expression and then validate the length of the result.

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
Vinod
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or