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

Validation error messages in grid

1 Answer 2282 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Douglas
Top achievements
Rank 1
Douglas asked on 17 May 2013, 03:23 PM
I'm evaluating the Kendo UI grid for possible use in a rails applications. Is there any way to customize the validation error messages for a column?

The validation seems to be working, but I still get the standard error messages:

schema: {
                        model: {
                            id: "id",
                            fields: {
                                name: { editable: true, validation: {required: true, message: "Brand name is required."}},
                                brand_code: {
                                    editable: true,
                                    validation: {pattern: "^[A-Z]{4}$", message: "Brand Code must be 4 upper case characters."}
                                },
                                brand_type: {editable: true, validation: { required: true }}
                            }
                        },
                        errors: "error"
                    }

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 18 May 2013, 11:53 AM
Hi Douglas,


The correct syntax to define custom message for the pattern validation check is the following
E.g.
BrandCode: {
    validation: {
        pattern: {
            value: "^[A-Z]{4}$",
            message: "Brand Code must be 4 upper case characters."
        }
    }
}

You could also add more validations with different custom messages.
E.g.
BrandCode: {
      validation: {
          pattern: {
              value: "^[A-Z]{4}$",
              message: "Brand Code must be 4 upper case characters."
          },
          required: {
              message: "Brand Code is required."
          }
      }
}

 

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Douglas
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or