Issue with Custom Validation Error Messages in Kendo Grid

2 Answers 40 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.

2 Answers, 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
0
henrry
Top achievements
Rank 1
answered on 15 May 2024, 04:59 AM | edited on 15 May 2024, 05:01 AM

In Kendo Grid, custom validation error messages might present challenges due to their integration within the grid's architecture. These issues often stem from difficulties in accurately associating error messages with specific data fields, particularly when using complex data structures or custom validation logic. Additionally, what is meta App manager managing the visibility and formatting of these messages across different grid configurations and interactions can pose further complications. Addressing these challenges typically involves careful configuration of validation rules, precise error message binding, and thorough testing to ensure consistent behavior across various scenarios.

Tags
Miscellaneous
Asked by
Varun
Top achievements
Rank 1
Answers by
Neli
Telerik team
henrry
Top achievements
Rank 1
Share this question
or