Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Too strict validation of form field names (HTML4 instead of HTML5) #53977

Copy link
Copy link
Open
@ThomasLandauer

Description

@ThomasLandauer
Issue body actions

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 names of form fields are still following the HTML4 specs.
However, they changed in HTML5 - the only forbidden names 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.