Skip to content

Commit

Permalink
bug #3433 [WIP][Reference][Form Types] Update "radio" form type (bicpi)
Browse files Browse the repository at this point in the history
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 | #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
  • Loading branch information
weaverryan committed Jan 21, 2014
2 parents 1d1b91d + 322b21e commit ea5816f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
12 changes: 1 addition & 11 deletions reference/forms/types/checkbox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,7 @@ Example Usage
Field Options
-------------

value
~~~~~

**type**: ``mixed`` **default**: ``1``

The value that's actually used as the value for the checkbox. This does
not affect the value that's set on your object.

.. caution::

To make a checkbox checked by default, set the `data`_ option to ``true``.
.. include:: /reference/forms/types/options/value.rst.inc

Inherited options
-----------------
Expand Down
12 changes: 12 additions & 0 deletions reference/forms/types/options/value.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
value
~~~~~

**type**: ``mixed`` **default**: ``1``

The value that's actually used as the value for the checkbox or radio button.
This does not affect the value that's set on your object.

.. caution::

To make a checkbox or radio button checked by default, use the `data`_
option.
29 changes: 9 additions & 20 deletions reference/forms/types/radio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
+-------------+---------------------------------------------------------------------+
| Rendered as | ``input`` ``radio`` field |
+-------------+---------------------------------------------------------------------+
| Options | - `value`_ |
+-------------+---------------------------------------------------------------------+
| Inherited | - `data`_ |
| options | - `empty_data`_ |
| Inherited | - `value`_ |
| options | - `data`_ |
| | - `empty_data`_ |
| | - `required`_ |
| | - `label`_ |
| | - `label_attr`_ |
Expand All @@ -28,29 +27,19 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
| | - `error_mapping`_ |
| | - `mapped`_ |
+-------------+---------------------------------------------------------------------+
| Parent type | :doc:`form </reference/forms/types/form>` |
| Parent type | :doc:`checkbox </reference/forms/types/checkbox>` |
+-------------+---------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` |
+-------------+---------------------------------------------------------------------+

Field Options
-------------

value
~~~~~

**type**: ``mixed`` **default**: ``1``

The value that's actually used as the value for the radio button. This does
not affect the value that's set on your object.

.. caution::

To make a radio button checked by default, use the `data`_ option.

Inherited Options
-----------------

These options inherit from the :doc:`checkbox </reference/forms/types/checkbox>`
type:

.. include:: /reference/forms/types/options/value.rst.inc

These options inherit from the :doc:`form </reference/forms/types/form>` type:

.. include:: /reference/forms/types/options/data.rst.inc
Expand Down

0 comments on commit ea5816f

Please sign in to comment.