Issue with Custom Validation Error Messages in Kendo Grid

1 Answer 21 Views
Miscellaneous
Varun
Top achievements
Rank 1
Varun asked on 20 Feb 2024, 03:56 PM

Dear Kendo Experts,

I hope this message finds you well.

I am currently facing an issue with custom validation error messages in a Kendo Grid. I have created a sample Dojo link to demonstrate the problem:

https://dojo.telerik.com/IgOLaREr

I have a kendo grid with a custom editor (dropdownlist) for a column (Category). 

In the provided Kendo Grid, I have two columns: "ProductName" and "Category". While "ProductName" has a default editor, "Category" has a custom editor (dropdown list).

I have defined custom validation error messages for both columns in the schema. However, the custom validation error message for the "Category" column does not appear when validation fails, unlike the "ProductName" column. Please refer the below screenshot.

Could you please assist me in resolving this issue? I would like the custom validation error message for the "Category" column to be displayed when validation fails, similar to the "ProductName" column.

Thank you very much for your time and assistance. I look forward to hearing from you soon.

Best regards,

Varun Shridhar.

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 23 Feb 2024, 12:00 PM

Hello Varun,

You can override the validation message for the column using the approach below:

(function ($, kendo) {
            $.extend(true, kendo.ui.validator, {
              messages: { //custom rules messages
                required: function (input) {
                  debugger;
                  if(input.is('[name="CategoryID"]')){
                    return "custom error message";
                  }
                }
              }
            });            
          })(jQuery, kendo);

Here you will find the modified Dojo example: https://dojo.telerik.com/@NeliK/ETasAHuJ

I hope this helps. 

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Miscellaneous
Asked by
Varun
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or