File tree Expand file tree Collapse file tree 4 files changed +23
-21
lines changed Expand file tree Collapse file tree 4 files changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -51,5 +51,5 @@ Hidden Fields
51
51
Base Fields
52
52
~~~~~~~~~~~
53
53
54
- * :doc:`hidden </ reference/forms/types/hidden > `
54
+ * :doc:`field </ reference/forms/types/field > `
55
55
* :doc:`form</ reference/forms/types/form> `
Original file line number Diff line number Diff line change 1
1
* ``data`` [type: any, default: the field's initial value]
2
- When you create a form, each field initially displays the value of the
3
- corresponding property of the form's domain object. If you want to override
4
- this initial value, you can set it in the data option.
2
+ When you create a form, each field initially displays the value of the
3
+ corresponding property of the form's domain object. If you want to override
4
+ this initial value, you can set it in the data option.
5
5
6
- .. code-block:: php
6
+ .. code-block:: php
7
7
8
- use Symfony\Component\Form\HiddenField
8
+ use Symfony\Component\Form\HiddenField
9
9
10
- $field = new HiddenField('token', array(
11
- 'data' => 'abcdef',
12
- ));
13
- assert('abcdef' === $field->getData());
10
+ $field = new HiddenField('token', array(
11
+ 'data' => 'abcdef',
12
+ ));
13
+
14
+ // renders abcdef
15
+ echo $field->getData();
14
16
15
17
Original file line number Diff line number Diff line change 1
1
* ``disabled`` [type: Boolean, default: false]
2
- If you don't want a user to modify the value of a field, you can set
3
- the disabled option to true. Any submitted value will be ignored.
2
+ If you don't want a user to modify the value of a field, you can set
3
+ the disabled option to true. Any submitted value will be ignored.
4
4
5
- .. code-block:: php
5
+ .. code-block:: php
6
6
7
- use Symfony\Component\Form\TextField
7
+ use Symfony\Component\Form\TextField
8
8
9
- $field = new TextField('status', array(
10
- 'data' => 'Old data',
11
- 'disabled' => true,
12
- ));
13
- $field->submit('New data');
9
+ $field = new TextField('status', array(
10
+ 'data' => 'Old data',
11
+ 'disabled' => true,
12
+ ));
13
+ $field->submit('New data');
14
14
15
- assert('Old data' === $field->getData());
15
+ // prints "Old data"
16
+ echo $field->getData();
16
17
17
18
Original file line number Diff line number Diff line change 1
-
2
1
* ``preferred_choices`` [type: array]
3
2
If this option is specified, then a sub-set of the total number of options
4
3
will be moved to the top of the select menu. The following would move
You can’t perform that action at this time.
0 commit comments