Declined
Last Updated: 02 Jul 2021 05:02 by ADMIN
Neel
Created on: 24 Jun 2021 17:43
Category: Form
Type: Feature Request
0
Required Validation Error Message Should Show Label

Create a new instance of a Kendo form with an item where the validation's required property is set to true. For example:

<!DOCTYPE html>
<html>
  <head>
    <title>Example Form</title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.default-v2.min.css" />
  </head>
  <body>
    <form id="example"></form>
    <script src="https://kendo.cdn.telerik.com/2021.2.616/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js"></script>
    <script>
      $(document).ready(function () {
        var validationSuccess = $("#validation-success");

        $("#example").kendoForm({
          formData: {
            FirstName: ''
          },
          layout: 'grid',
          grid: {
            cols: 2,
            gutter: 16
          },
          items: [
            {
              field: 'FirstName',
              label: 'First Name',
              validation: {
                required: true
              }
            }
          ]
        });
      });
    </script>
  </body>
</html>

The feature request is to send the label value to the validator rather than the field value.

I understand that the required property can take an object, such as:

required: { message: 'First Name is required' }
While there is nothing wrong with this approach, it does require a duplication of effort which can become cumbersome.
1 comment
ADMIN
Nencho
Posted on: 02 Jul 2021 05:02

Hello,

Thank you for the suggestions.

Even if it sounds practical, we would need to decline it at first glance, due to the following:

If we include only the label, as a field sent to the validator - this would limit the usage only to the message being sent to the validator (please consider the case if someone doesn't even have a message(label) set for the component ). Also, this would cause duplication in the localization of the component.

Regards,
Nencho
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.