Completed
Last Updated: 16 Jun 2021 15:07 by ADMIN
Christoph
Created on: 12 Jan 2019 18:33
Category: Kendo UI for Angular
Type: Feature Request
5
Form Validation

Forms are what we use every day and if there's a form, we often have to validate the input and show the validation results to the user.

Problems:

  • The way to do this today with angular requires a lot of code (see https://angular.io/guide/form-validation for examples)
  • In many cases we have to handle and show the same validation errors over and over again. E.g. "this field is required"

Opportunity:

  • The way validation errors are shown is similar in most applications and can be easily adjusted using simple CSS.
  • Common validation error messages should be ok for many applications.

Feature request:

  • Add a component to easily display validation errors of form components.
  • Add global validation settings to customize standard error messages and behavior.

Example:

// global setup
validationService.configure({ showIf: 'touchedOrDirty', messages: { required: "This field is required', customKey: 'This field needs ... ', customKey2: errorMessageForCustomKey2Fn }); // callback to generated error message for customKey2 function errorMessageForCustomKey2Fn(control: FormControl) => return `can include 'but is ... ' from form control`; // HTML in component template <input formControlName="myinput" ... /> <validation-errors forControlName="myinput"> // < should handle all globally registered errors without additional code. <error key="keyOfValidatorOnlyUsedHere">Sorry, but you have to</error> </validation-errors>

I think such a feature could massively reduce the work to setup forms.

2 comments
ADMIN
Svet
Posted on: 16 Jun 2021 15:07

Hi Christoph,

I am glad to let you know that we have released the FormField component which allows to configure form fields by adding errors and hints to them:

https://www.telerik.com/kendo-angular-ui/components/forms/forms-guideline/#toc-formfield-component

As for the second part of this case, we decided not to overtake any further steps as the default messages could be displayed dynamically within the <kendo-formerror> or <kendo-formhint> components.

Regards,
Svetlin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

ADMIN
Dimiter Topalov
Posted on: 14 Jan 2019 11:31
Hello Christoph,

Thank you for sharing your idea.

Configuring and customizing Angular forms in general and form validation in particular, can indeed prove to be a tedious and time consuming task, and such a configurable component and service like the ones, outlined in the feature request, would indeed be a nice addition to our suite.

We will track this thread to estimate the customer demand, and will consider introducing such an enhancement in one of our future releases.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.