Skip to content

[Form] Names for buttons should start with lowercase #32335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2019

Conversation

mcfedr
Copy link
Contributor

@mcfedr mcfedr commented Jul 3, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

This fix changes the messages related to the changes in #28969 - the message used to state that names should start with a letter, a digit ... - so I got a confusing message:

Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("Search" given).'

Which made me find the message, look at the regex that was used, and work out that actually it should start with a lowercase letter, and hence this PR - where I assume there is a reason that the name must start with lowercase letters.

@javiereguiluz
Copy link
Member

The HTML standard allows anything for the name attribute: see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name

But I guess we're restricting here because this name is used as part of things like Twig block names? In any case, the no-uppercase-for-first-character restriction looks odd.

@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Jul 3, 2019
@fabpot
Copy link
Member

fabpot commented Sep 25, 2019

Thank you @mcfedr.

fabpot added a commit that referenced this pull request Sep 25, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[Form] Names for buttons should start with lowercase

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

This fix changes the messages related to the changes in #28969 - the message used to state that names should start with a letter, a digit ... - so I got a confusing message:

```
Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("Search" given).'
```

Which made me find the message, look at the regex that was used, and work out that actually it should start with a lowercase letter, and hence this PR - where I assume there is a reason that the name must start with lowercase letters.

Commits
-------

f65524e Names for buttons should start with lowercase
@fabpot fabpot merged commit f65524e into symfony:4.3 Sep 25, 2019
@fabpot fabpot mentioned this pull request Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants