- Issue created by @alexpott
- ๐ฆ๐บAustralia sime Melbourne
It took me a while to find that calling
setErrorByName()was the way to set an error not by name. At least the parameter documentation should describe this. - ๐ฎ๐ณIndia Akhil Babu Chengannur
Akhil Babu โ made their first commit to this issueโs fork.
- ๐ฎ๐ณIndia Akhil Babu Chengannur
The
FormState::setErrorByName()function accepts 2 arguments,$nameand$message. When$nameis provided, the corresponding element will be highlighted during validation errors. If$nameis empty or'', the error message will still be displayed above the form, but no form elements will be highlighted.From the issue description, I assume that calling
setErrorByName()with an empty $name parameter (Like$form_state->setErrorMessage('', 'Custom error message')) should be deprecated. Based on this, I have created a new functionsetErrorMessage()that will be called when$nameis empty as a first step. - Merge request !6473Issues/3399510: Deprecate passing empty value to paramater of setErrorByName method. โ (Open) created by Akhil Babu