Input Validation Issue With Dropdown and Calendar

UI Components for Angular
Post Reply
sisqo102
Posts: 1
Joined: 29 Sep 2022, 16:46

29 Sep 2022, 16:55

Hi everyone. Our team is having the following problem. I have verified that this problem does NOT happen with a standard select dropdown in html.


We have this code used to check if we need to display a custom error message:

showError(formControl: AbstractControl): boolean {
return formControl.touched && formControl.invalid
}

With a simple ngif checking if that's true to display an error.



The problem with the primeNg components specifically, is that touched is fired when holding mouse down, when selecting an option, or a date from the calendar. While the mouse is held down, the error will be displayed (but it should not), and then upon mouse-up the error will go away. This gives the impression of a briefly flashed error message on a standard click.

I'm trying to change to use formControl.Dirty, because that solves the flash, however now we don't get our error message when we leave the control with no value (we still want that).


Is this a bug? Has anyone dealt with this?

Thank you!

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests