8000 [Form] empty_value should not be selectable in choice field if the field is required by nicam · Pull Request #6384 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] empty_value should not be selectable in choice field if the field is required #6384

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
Dec 16, 2012

Conversation

nicam
Copy link
Contributor
@nicam nicam commented Dec 16, 2012

When the Choice field is required one should not be able to select the empty_value. The empty_value field is supposed to be a placeholder and not a real value.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: none
Todo: nothing
License of the code: MIT
Documentation PR: none

SEE #6116

@webmozart
Copy link
Contributor

👍

fabpot added a commit that referenced this pull request Dec 16, 2012
This PR was merged into the master branch.

Commits
-------

a9c27fb [Form] empty_value should not be selectable in choice field if the field is required

Discussion
----------

[Form] empty_value should not be selectable in choice field if the field is required

When the Choice field is required one should not be able to select the empty_value. The empty_value field is supposed to be a placeholder and not a real value.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: none
Todo: nothing
License of the code: MIT
Documentation PR: none

SEE #6116

---------------------------------------------------------------------------

by bschussek at 2012-12-16T13:51:17Z

:+1:
@fabpot fabpot merged commit a9c27fb into symfony:master Dec 16, 2012
@MaksSlesarenko
Copy link
Contributor
{% if empty_value is not none %}
            <option value="" disabled="disabled"{% if value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
        {% endif %}
        {% if preferred_choices|length > 0 %}
            {% set options = preferred_choices %}
            {{ block('choice_widget_options') }}
            {% if choices|length > 0 and separator is not none %}
                <option disabled="disabled">{{ separator }}</option>
            {% endif %}
        {% endif %}
        {% set options = choices %}
        {{ block('choice_widget_options') }}

Backwards compatibility break: no ??? WTF?!

How can I deselect choice if empty_value is hardcoded to disabled state?

fabpot pushed a commit that referenced this pull request Jan 23, 2013
fabpot added a commit that referenced this pull request Jan 23, 2013
This PR was squashed before being merged into the master branch (closes #6734).

Commits
-------

4d51ec0 Fix for hardcode (#6384) in choice widget

Discussion
----------

Fix for hardcode (#6384) in choice widget

empty_value should not be disabled if field is not required!

#6384

---------------------------------------------------------------------------

by sstok at 2013-01-15T15:51:08Z

You need to revert the file mode changes (100644 → 100755)

---------------------------------------------------------------------------

by MaksSlesarenko at 2013-01-18T16:44:42Z

fixed tests

---------------------------------------------------------------------------

by MaksSlesarenko at 2013-01-21T15:36:59Z

ping @fabpot

---------------------------------------------------------------------------

by fabpot at 2013-01-21T15:58:26Z

ping @bschussek

---------------------------------------------------------------------------

by MaksSlesarenko at 2013-01-23T11:15:37Z

ping @fabpot @bschussek

---------------------------------------------------------------------------

by Tobion at 2013-01-23T12:08:19Z

I think it's good to squash and merge.

---------------------------------------------------------------------------

by fabpot at 2013-01-23T12:16:37Z

Can you rebase and squash before I merge? Thanks.

---------------------------------------------------------------------------

by MaksSlesarenko at 2013-01-23T19:51:36Z

@fabpot done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0