File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
reference/forms/types/options Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
1
data
2
2
~~~~
3
3
4
- **type**: ``mixed`` **default**: Defaults to field of the underlying object (if there is one)
4
+ **type**: ``mixed`` **default**: Defaults to field of the underlying structure.
5
5
6
- When you create a form, each field initially displays the value of the
7
- corresponding property of the form's domain object (if an object is bound
8
- to the form). If you want to override the initial value for the form or
9
- just an individual field, you can set it in the data option::
6
+ When you attach a form type to a form, it becomes a field that initially maps
7
+ the value of the corresponding property or key of the form's domain data. If
8
+ you want to override the initial value which will be rendered in the view for
9
+ the form or any field, you can set it in the data option::
10
10
11
11
$builder->add('token', 'hidden', array(
12
12
'data' => 'abcdef',
@@ -15,5 +15,5 @@ just an individual field, you can set it in the data option::
15
15
.. note::
16
16
17
17
The default values for form fields are taken directly from the underlying
18
- data structure (e.g. an entity or an array). The ``data`` option overrides
19
- this default value.
18
+ data structure matching the field name with a property of an object or a
19
+ key of an array. The ``data`` option overrides this default value.
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ empty_data
10
10
DEFAULT_PLACEHOLDER
11
11
12
12
This option determines what value the field will return when the submitted
13
- value is empty.
13
+ value is empty. It does not set an initial value if none is provided when
14
+ the form is rendered in a view (see `Data` or `Placeholder` options).
14
15
15
- But you can customize this to your needs. For example, if you want the
16
- ``gender`` choice field to be explicitly set to ``null`` when no value is
17
- selected, you can do it like this::
16
+ It helps you handling form submission and you can customize this to your needs.
17
+ For example, if you want the ``gender`` choice field to be explicitly set to ``null``
18
+ when no value is selected, you can do it like this::
18
19
19
20
$builder->add('gender', 'choice', array(
20
21
'choices' => array(
You can’t perform that action at this time.
0 commit comments