Skip to content

issue-13589: adjust docs for custom-false-values for checkbox type #9031

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

Conversation

leberknecht
Copy link
Contributor

refs #13589 on symfony/symfony repo

@xabbuh xabbuh added this to the 4.1 milestone Jan 10, 2018
@xabbuh xabbuh added the Waiting Code Merge Docs for features pending to be merged label Jan 10, 2018
symfony-splitter pushed a commit to symfony/form that referenced this pull request Jan 17, 2018
…oString transformer (leberknecht)

This PR was squashed before being merged into the 4.1-dev branch (closes #25741).

Discussion
----------

[Form] issue-13589: adding custom false-values to BooleanToString transformer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13589
| License       | MIT
| Doc PR        | symfony/symfony-docs#9031

As suggested in #13589 , this PR adds the option to specify custom false-values, so we can use the CheckBoxType to handle strings '1' / '0' and eval them to true / false. While HTTP defines that checkbox types are either submitted=true or not-submitted=false, no matter of what value was submitted, it would be nice to have this option.
Also refs (which read like "the basic idea of the feature was accepted, PR almost done, then something-happend so PR wasnt merged"..?)

symfony/symfony#15054
symfony/symfony#18005

Commits
-------

a3e5ac496f [Form] issue-13589: adding custom false-values to BooleanToString transformer
fabpot added a commit to symfony/symfony that referenced this pull request Jan 17, 2018
…oString transformer (leberknecht)

This PR was squashed before being merged into the 4.1-dev branch (closes #25741).

Discussion
----------

[Form] issue-13589: adding custom false-values to BooleanToString transformer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13589
| License       | MIT
| Doc PR        | symfony/symfony-docs#9031

As suggested in #13589 , this PR adds the option to specify custom false-values, so we can use the CheckBoxType to handle strings '1' / '0' and eval them to true / false. While HTTP defines that checkbox types are either submitted=true or not-submitted=false, no matter of what value was submitted, it would be nice to have this option.
Also refs (which read like "the basic idea of the feature was accepted, PR almost done, then something-happend so PR wasnt merged"..?)

#15054
#18005

Commits
-------

a3e5ac4 [Form] issue-13589: adding custom false-values to BooleanToString transformer
@javiereguiluz javiereguiluz removed the Waiting Code Merge Docs for features pending to be merged label Jan 18, 2018
@xabbuh xabbuh added the Form label Jan 22, 2018
@javiereguiluz
Copy link
Member

@vudaltsov we'd need your review about this proposal related to forms. Thanks a lot!

@vudaltsov
Copy link
Contributor

@javiereguiluz , thanx for pinging me on this :)

I agree with the contents of this PR, but I would also dedicate a paragraph to the false_values option in the Field Options section.

Copy link
Contributor

@vudaltsov vudaltsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a section under Field Options.

@xabbuh xabbuh changed the base branch from master to 4.1 May 8, 2018 08:42

+-------------+------------------------------------------------------------------------+
| Rendered as | ``input`` ``checkbox`` field |
+-------------+------------------------------------------------------------------------+
| Options | - `value`_ |
| | - `false_values`_ |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the description of this option seems to be missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! Indeed, sorry. Added.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and maybe we should sort the options alphabetically (i.e. put false-values before value). This must then also be taken into account below then.

@@ -0,0 +1,6 @@
false_values
~~~~~
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line must contain as many ~ characters as the length of the headline


**type**: ``array`` **default**: ``array(null)``

An array of values to be interpreted as `false`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to backticks here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ops, two (not to) :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doh!" again :D fixed

@javiereguiluz
Copy link
Member

@leberknecht thanks for this contribution! Sadly I couldn't merge it with the proprietary tool we use to merge pull requests in Symfony repos. I tried to solve it but I couldn't (for some unknown reasons, the conflict was huge with tens of conflicting files). So, I ended up replicating your changes in this other pull request: #9812. I'm really sorry but I wanted to assure you that I tried to maintain your commits and pull request but I couldn't. I'm sorry.

javiereguiluz added a commit that referenced this pull request May 24, 2018
…iereguiluz)

This PR was merged into the 4.1 branch.

Discussion
----------

Documented the false_values option of checkbox types

This is the same as #9031, which I couldn't merge because of Git conflicts.

Commits
-------

a0a88a2 Documented the false_values option of checkbox types
@leberknecht
Copy link
Contributor Author

:D No worries!

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