How to add custom validation in Grid Textarea

2 posts, 0 answers
  1. Anoop
    Anoop avatar
    1 posts
    Member since:
    Jul 2016

    Posted 14 Dec 2016 Link to this post

    I have custom template like below

    schema: {
    model: {
    id: 'ID',
    fields: {
    myField: {

              validation: { required: true,
             myfieldvalidation: function (input) {

                                            //Some logic goes here.
                                           input.attr("data-myfieldvalidation-msg", "This is not good");
                                        return false;



    and field declaration as

    {field: "myField", template: function (dataItem) { return BuildInput(dataItem)}, title: "myField Value"}

    calling following function as need logic to build textarea or to show read only. Calling following function just to clear code.

    function BuildInput(dataObject) {

       if(editAllowed) {

        return ('<textarea rows="3" cols="4"  type="text" class="k-input k-textbox " name="myField " data-bind="value:myField " ></textarea>');

       } else {

        return dataObject.myField ;



    This textarea and binding works perfectly. But when I add validation like added above. On blur textarea is changing to input field which I don't want.

    How to add validation in Kendo Grid with textArea template.

    I have seen this:

    but above example deals only with input type not textarea.

    Moreover, I can workaround with onchange function on textarea but,  onBlur Kendo is regenerating TD content so I can't use my external function to add error message there.

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2026 posts

    Posted 16 Dec 2016 Link to this post

    Hello Anoop,

    Maybe I am missing something but the provided code actually does not perform two way binding. Could you please provide a sample dojo example or modify with two way binding applied in order to provide some suggestions for the validation? 

    Boyan Dimitrov
    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.
Back to Top