Pending Review
Last Updated: 14 Jan 2019 11:31 by ADMIN
Christoph
Created on: 12 Jan 2019 18:33
Category: Kendo UI for Angular 2+
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.

1 comment
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.