Easy way to customize "required" error on forms
Posted by edsardachuk - November 17, 2024
Drupal keeps surprising even after so many years :) Just set the #required_error attribute to the desired message in the form element render array.
I remember back in the days we would use \Drupal::messenger() to clear the messages and set our own error if needed the custom texting. LOL