8000 [Form] Fixed required value guessed by ValidatorTypeGuesser by webmozart · Pull Request #3821 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fixed required value guessed by ValidatorTypeGuesser #3821

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
Apr 7, 2012

Conversation

webmozart
Copy link
Contributor

Bug fix: yes
Feature addition: no
Backwards compatibility break: no*
Symfony2 tests pass: yes
Fixes the following tickets: #3661
Todo: -

Travis Build Status

The documentation states that a field is set to required if constrained with NotBlank or NotNull and to not required otherwise. Due to a bug this was not the case and fields were always required. This is now fixed.

The consequence is that some fields that were required before by default are not required anymore. The only difference is that the HTML5 "required" attribute disappears, because server-side validation did not occur before anyway.

fabpot added a commit that referenced this pull request Apr 7, 2012
Commits
-------

e0ce6b4 [Form] Fixed required value guessed by ValidatorTypeGuesser

Discussion
----------

[Form] Fixed required value guessed by ValidatorTypeGuesser

Bug fix: yes
Feature addition: no
Backwards compatibility break: no*
Symfony2 tests pass: yes
Fixes the following tickets: #3661
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3661)

The documentation states that a field is set to required if constrained with NotBlank or NotNull and to not required otherwise. Due to a bug this was not the case and fields were always required. This is now fixed.

The consequence is that some fields that were required before by default are not required anymore. The only difference is that the HTML5 "required" attribute disappears, because server-side validation did not occur before anyway.
@fabpot fabpot merged commit e0ce6b4 into symfony:master Apr 7, 2012
@hellomedia
Copy link
Contributor

This was merged to 2.1 but not 2.0 . Is there a particular reason or should I try with a pull request for 2.0 ?

@Tobion
Copy link
Contributor
Tobion commented Aug 18, 2012

Hm, for some reason all my fields still have the required="required" attribute rendered when I don't explicitely set this attribute to false (in latest 2.1). So it doesn't matter what the constraints are or if there are none.

@Tobion
Copy link
Contributor
Tobion commented Aug 18, 2012

Ok I know why, as stated in the doc:

These field options are only guessed if you're using Symfony to guess the field type (i.e. omit or pass null as the second argument to add()).

@Tobion
Copy link
Contributor
Tobion commented Aug 18, 2012

I dislike that the default for required is true, as such extra functionality like HTML5 validation should be opt-in and not opt-out. Also it's quite inconsistent as client-side the default is required but on the server side the default is non-required.
So in the default config without options and without constraints, client <> server.

@tonypiper
Copy link
Contributor

+1, @Tobion

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.

6 participants
0