Skip to content

Commit ea5816f

Browse files
committed
bug symfony#3433 [WIP][Reference][Form Types] Update "radio" form type (bicpi)
This PR was merged into the 2.3 branch. Discussion ---------- [WIP][Reference][Form Types] Update "radio" form type | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3+ | Fixed tickets | symfony#3410 `radio`'s parent is `checkbox`, not `form`. I need some help regarding the task *value option should be removed from this type*: Should it really be removed? It's because I'm able to set it and it is used in the HTML output. I'm retrieving a boolean value only when I access the submitted data via the form framework but I have also access to the raw, custom value via e.g. `$request->request->get('my_checkbox')`. So maybe it should be moved to the `inherited options` instead for the `radio` field? If yes, the wording would need an update for the `value` option and if no, why keep it for the `checkbox` field? Commits ------- 322b21e Update&Outsource "value" option & update references be47b90 Fix parent type doc reference 22b3d0c [Reference][Form Types] Update "radio" form type
2 parents 1d1b91d + 322b21e commit ea5816f

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

reference/forms/types/checkbox.rst

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,7 @@ Example Usage
4242
Field Options
4343
-------------
4444

45-
value
46-
~~~~~
47-
48-
**type**: ``mixed`` **default**: ``1``
49-
50-
The value that's actually used as the value for the checkbox. This does
51-
not affect the value that's set on your object.
52-
53-
.. caution::
54-
55-
To make a checkbox checked by default, set the `data`_ option to ``true``.
45+
.. include:: /reference/forms/types/options/value.rst.inc
5646

5747
Inherited options
5848
-----------------
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
value
2+
~~~~~
3+
4+
**type**: ``mixed`` **default**: ``1``
5+
6+
The value that's actually used as the value for the checkbox or radio button.
7+
This does not affect the value that's set on your object.
8+
9+
.. caution::
10+
11+
To make a checkbox or radio button checked by default, use the `data`_
12+
option.

reference/forms/types/radio.rst

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
1515
+-------------+---------------------------------------------------------------------+
1616
| Rendered as | ``input`` ``radio`` field |
1717
+-------------+---------------------------------------------------------------------+
18-
| Options | - `value`_ |
19-
+-------------+---------------------------------------------------------------------+
20-
| Inherited | - `data`_ |
21-
| options | - `empty_data`_ |
18+
| Inherited | - `value`_ |
19+
| options | - `data`_ |
20+
| | - `empty_data`_ |
2221
| | - `required`_ |
2322
| | - `label`_ |
2423
| | - `label_attr`_ |
@@ -28,29 +27,19 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
2827
| | - `error_mapping`_ |
2928
| | - `mapped`_ |
3029
+-------------+---------------------------------------------------------------------+
31-
| Parent type | :doc:`form </reference/forms/types/form>` |
30+
| Parent type | :doc:`checkbox </reference/forms/types/checkbox>` |
3231
+-------------+---------------------------------------------------------------------+
3332
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` |
3433
+-------------+---------------------------------------------------------------------+
3534

36-
Field Options
37-
-------------
38-
39-
value
40-
~~~~~
41-
42-
**type**: ``mixed`` **default**: ``1``
43-
44-
The value that's actually used as the value for the radio button. This does
45-
not affect the value that's set on your object.
46-
47-
.. caution::
48-
49-
To make a radio button checked by default, use the `data`_ option.
50-
5135
Inherited Options
5236
-----------------
5337

38+
These options inherit from the :doc:`checkbox </reference/forms/types/checkbox>`
39+
type:
40+
41+
.. include:: /reference/forms/types/options/value.rst.inc
42+
5443
These options inherit from the :doc:`form </reference/forms/types/form>` type:
5544

5645
.. include:: /reference/forms/types/options/data.rst.inc

0 commit comments

Comments
 (0)