How to exclude HTML tags for Kendo Editor length validation?

2 posts, 0 answers
  1. Vinod
    Vinod avatar
    1 posts
    Member since:
    Mar 2014

    Posted 26 Sep 2014 Link to this post


    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:

    [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?

    V. Joseph

  2. Alex Gyoshev
    Alex Gyoshev avatar
    2498 posts

    Posted 29 Sep 2014 Link to this post

    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.

    Alex Gyoshev

    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.

  3. UI for ASP.NET AJAX banner
Back to Top