We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Validation is not firing on dropdown selection change

Hi,

I am trying to validate the dropdown as its value changes, however the validation is not firing until the the focus is lost from the control, until you unclick from it. Even if the selection is valid, "This field is required." message still appears until the control loses focus.
What should I do to have it validated so that the "This field is required" error message is gone as soon as the selection is made from the dropdown?

Thank you!

<e-column field='testFieldId' headerText='Test Header' textAlign='Left' editType='dropdownedit'

 [validationRules]='requiredRule' [edit]='editParamsVisit' [allowEditing]='userHasWriteClaim'>
</e-column>


1 Reply 1 reply marked as answer

SI Santhosh Iruthayaraj Syncfusion Team January 6, 2023 02:04 PM UTC

Hi David Akobia,


Greetings from the Syncfusion Support,


We evaluated your query “Validation is not firing on dropdown selection change” and found that you can use to form.validate method inside the change event of the dropdown editing it will validating  the dropdown selected item on Grid’s editing.


Please refer the below code example and attached sample for more information.


app.component.ts

 

import { ComponentOnInitViewChild } from '@angular/core';

export class AppComponent implements OnInit {

  @ViewChild('grid')

  public gridGridComponent;

  public ddParamsIEditCell;

 ngOnInit(): void {

    this.ddParams = {

      params: {

        value: '',

        change: () => {

          this.grid.editModule.formObj.validate();

        },

      },

    };

  }


Sample link - https://stackblitz.com/edit/angular-rsdbcx-czzpup?file=src%2Fapp.component.ts


Regards,

Santhosh Iruthayaraj


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon