- 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,$name
and$message
. When$name
is provided, the corresponding element will be highlighted during validation errors. If$name
is 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$name
is empty as a first step. - Merge request !6473Issues/3399510: Deprecate passing empty value to paramater of setErrorByName method. โ (Open) created by Akhil Babu