diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index 3389847..a990717 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -1,58 +1,88 @@ .. index:: single: Forms; Fields; checkbox -checkbox Field Type -=================== - -Creates a single input checkbox. This should always be used for a field that -has a Boolean value: if the box is checked, the field will be set to true, -if the box is unchecked, the value will be set to false. - -+-------------+------------------------------------------------------------------------+ -| Rendered as | ``input`` ``text`` field | -+-------------+------------------------------------------------------------------------+ -| Options | - `value`_ | -+-------------+------------------------------------------------------------------------+ -| Inherited | - `required`_ | -| options | - `label`_ | -| | - `read_only`_ | -| | - `error_bubbling`_ | -+-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field` | -+-------------+------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` | -+-------------+------------------------------------------------------------------------+ - -Example Usage -------------- +.. note:: + + * 対象バージョン:2.3+ + * 翻訳更新日:2014/05/18 + +checkbox フィールドタイプ +========================= + +単一の入力チェックボックスを作成します。これは、常にブール値を持つフィールドに使用する必要があります。 +チェックボックスがチェックされている場合 true に設定され、チェックボックスをオフにすると、 false に設定されます。 + ++------------------+------------------------------------------------------------------------+ +| 対応するデータ型 | ``input`` ``checkbox`` フィールド | ++------------------+------------------------------------------------------------------------+ +| オプション | - `value`_ | ++------------------+------------------------------------------------------------------------+ +| 上書きされた | - `empty_data`_ | +| オプション | - `compound`_ | ++------------------+------------------------------------------------------------------------+ +| 継承された | - `data`_ | +| オプション | - `required`_ | +| | - `label`_ | +| | - `label_attr`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `error_bubbling`_ | +| | - `error_mapping`_ | +| | - `mapped`_ | ++------------------+------------------------------------------------------------------------+ +| 親タイプ | :doc:`form ` | ++------------------+------------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` | ++------------------+------------------------------------------------------------------------+ + +使用例 +------ .. code-block:: php $builder->add('public', 'checkbox', array( - 'label' => 'Show this entry publicly?', + 'label' => 'このエントリーを公開しますか?', 'required' => false, )); -Field Options -------------- +フィールドオプション +-------------------- -value -~~~~~ +.. include:: /reference/forms/types/options/value.rst.inc -**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. +.. include:: /reference/forms/types/options/checkbox_empty_data.rst.inc -Inherited options ------------------ +.. include:: /reference/forms/types/options/checkbox_compound.rst.inc -These options inherit from the :doc:`field` type: +継承されたオプション +-------------------- + +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/data.rst.inc .. include:: /reference/forms/types/options/required.rst.inc .. include:: /reference/forms/types/options/label.rst.inc +.. include:: /reference/forms/types/options/label_attr.rst.inc + .. include:: /reference/forms/types/options/read_only.rst.inc +.. include:: /reference/forms/types/options/disabled.rst.inc + .. include:: /reference/forms/types/options/error_bubbling.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +フォーム変数 +------------ + +.. include:: /reference/forms/types/variables/check_or_radio_table.rst.inc + +.. 2014/05/18 yositani2002 d49d12eaf265a5d6d32ac660c62f385d57261475 diff --git a/reference/forms/types/options/checkbox_compound.rst.inc b/reference/forms/types/options/checkbox_compound.rst.inc new file mode 100644 index 0000000..580a977 --- /dev/null +++ b/reference/forms/types/options/checkbox_compound.rst.inc @@ -0,0 +1,9 @@ +compound +~~~~~~~~ + +**データ型**: ``boolean`` **デフォルト**: ``false`` + +このオプションは、フォームが合成物であるかを指定します。 +チェックボックスの場合は該当しないため、デフォルトの値を ``false`` で上書きします。 + +.. 2014/05/18 yositani2002 8d4f444c25ba45439bef046bda1b1abb89c84ed0 diff --git a/reference/forms/types/options/checkbox_empty_data.rst.inc b/reference/forms/types/options/checkbox_empty_data.rst.inc new file mode 100644 index 0000000..3fce6f2 --- /dev/null +++ b/reference/forms/types/options/checkbox_empty_data.rst.inc @@ -0,0 +1,9 @@ +empty_data +~~~~~~~~~~ + +**データ型**: ``string`` **デフォルト**: ``mixed`` + +このオプションでは、\ ``empty_value`` 選択肢が選択されたときにどのような値を返すかを決定します。 +チェックボックスでは、\ ``empty_data`` の値はデータトランスフォーマー(参照 :doc:`/cookbook/form/data_transformers`) によって返された値で上書きされます。 + +.. 2014/05/18 yositani2002 64602c83849b29088bfbf60b46a8fb802bcc9860 diff --git a/reference/forms/types/options/label_attr.rst.inc b/reference/forms/types/options/label_attr.rst.inc index 03aea65..d2bed9b 100644 --- a/reference/forms/types/options/label_attr.rst.inc +++ b/reference/forms/types/options/label_attr.rst.inc @@ -19,4 +19,5 @@ label_attr array('label_attr' => array('class' => 'CUSTOM_LABEL_CLASS')) ); -.. 2014/05/10 yositani2002 82c1db5644d1373f000e8e8dc1a3624b010faeef +.. 2014/05/18 yositani2002 82c1db5644d1373f000e8e8dc1a3624b010faeef + diff --git a/reference/forms/types/options/value.rst.inc b/reference/forms/types/options/value.rst.inc new file mode 100644 index 0000000..d6ae41e --- /dev/null +++ b/reference/forms/types/options/value.rst.inc @@ -0,0 +1,13 @@ +value +~~~~~ + +**データ型**: ``mixed`` **デフォルト**: ``1`` + +実際にチェックボックスやラジオボタンの値として使われていた値です。 +これはオブジェクトにセットする値には影響しません。 + +.. caution:: + + デフォルトでチェックされたチェックチェックボックスやラジオボタンを作成するには、\ `data`_ オプションを使用します。 + +.. 2014/05/18 yositani2002 322b21e191c19d2c2d6a83f92762f72a5122b742 diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst index 4870739..62ba016 100644 --- a/reference/forms/types/radio.rst +++ b/reference/forms/types/radio.rst @@ -1,52 +1,73 @@ .. index:: single: Forms; Fields; radio -radio Field Type -================ +.. note:: -Creates a single radio button. This should always be used for a field that -has a Boolean value: if the radio button is selected, the field will be set -to true, if the button is not selected, the value will be set to false. + * 対象バージョン:2.3+ + * 翻訳更新日:2014/05/18 -The ``radio`` type isn't usually used directly. More commonly it's used -internally by other types such as :doc:`choice`. -If you want to have a Boolean field, use :doc:`checkbox`. +radio フィールドタイプ +====================== -+-------------+---------------------------------------------------------------------+ -| Rendered as | ``input`` ``text`` field | -+-------------+---------------------------------------------------------------------+ -| Options | - `value`_ | -+-------------+---------------------------------------------------------------------+ -| Inherited | - `required`_ | -| options | - `label`_ | -| | - `read_only`_ | -| | - `error_bubbling`_ | -+-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`field` | -+-------------+---------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` | -+-------------+---------------------------------------------------------------------+ +シングルラジオボタンを作成します。ラジオボタンを選択した場合は、フィールドは指定された値に設定されます。 +ラジオボタンはチェックをはずすことはできません - 値は、同じ名前で別のラジオボタンがチェックされるときに変更されます。 -Field Options -------------- +``radio`` 型は、通常は直接使用することはありません。 +一般的に、 :doc:`choice ` のようなほかのタイプの内部で使われます。 +``Boolean`` フィールドを使用したい場合は :doc:`checkbox ` を使用してください。 -value -~~~~~ ++------------------+---------------------------------------------------------------------+ +| 対応するデータ型 | ``input`` ``radio`` フィールド | ++------------------+---------------------------------------------------------------------+ +| 継承された | - `value`_ | +| オプション | - `data`_ | +| | - `empty_data`_ | +| | - `required`_ | +| | - `label`_ | +| | - `label_attr`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `error_bubbling`_ | +| | - `error_mapping`_ | +| | - `mapped`_ | ++------------------+---------------------------------------------------------------------+ +| 親タイプ | :doc:`checkbox ` | ++------------------+---------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` | ++------------------+---------------------------------------------------------------------+ -**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. +以下のオプションは :doc:`checkbox ` タイプを継承しています: -Inherited Options ------------------ +.. include:: /reference/forms/types/options/value.rst.inc -These options inherit from the :doc:`field` type: +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/data.rst.inc + +.. include:: /reference/forms/types/options/empty_data.rst.inc .. include:: /reference/forms/types/options/required.rst.inc .. include:: /reference/forms/types/options/label.rst.inc +.. include:: /reference/forms/types/options/label_attr.rst.inc + .. include:: /reference/forms/types/options/read_only.rst.inc +.. include:: /reference/forms/types/options/disabled.rst.inc + .. include:: /reference/forms/types/options/error_bubbling.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +フォーム変数 +------------ + +.. include:: /reference/forms/types/variables/check_or_radio_table.rst.inc + +.. 2014/05/18 yositani2002 490633b97f8c2931bc43a76dd060cfcc50da432d diff --git a/reference/forms/types/variables/check_or_radio_table.rst.inc b/reference/forms/types/variables/check_or_radio_table.rst.inc new file mode 100644 index 0000000..95c2d07 --- /dev/null +++ b/reference/forms/types/variables/check_or_radio_table.rst.inc @@ -0,0 +1,7 @@ +======== ============ ============================================ +変数 データ型 使い方 +======== ============ ============================================ +checked ``Boolean`` 現在の入力がチェックされているかどうか。 +======== ============ ============================================ + +.. 2014/05/18 yositani2002 1a1497c1b296cc0711d486b1a8925d029baa8e8f