Open
Description
Symfony version(s) affected
7.0.3
Description
Related to #53976 (which is basically the same for id
attributes)
The checks being performed on the name
s of form fields are still following the HTML4 specs.
However, they changed in HTML5 - the only forbidden name
s are now:
- empty string
isindex
_charset_
(case-insensitive)
Source: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name
So I suggest to adjust the check.
How to reproduce
Setup a form with:
public function getBlockPrefix(): string
{
return '-foo';
}
Resulting error:
The name "-foo" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").
Possible Solution
The check is happening in FormConfigBuilder::isValidName()
Additional Context
No response