Skip to content

Commit

Permalink
added some codes boxes and inc files
Browse files Browse the repository at this point in the history
  • Loading branch information
ikwattro committed May 23, 2011
1 parent 98bd4e4 commit 4f23b87
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
10 changes: 5 additions & 5 deletions reference/forms/types/field.rst
Expand Up @@ -9,12 +9,12 @@ functions as the parent field type for many other fields.

The ``field`` type predefines a couple of options :

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

* .. include:: /reference/forms/types/options/required.rst.inc
.. include:: /reference/forms/types/options/required.rst.inc

* .. include:: /reference/forms/types/options/disabled.rst.inc
.. include:: /reference/forms/types/options/disabled.rst.inc

* .. include:: /reference/forms/types/options/trim.rst.inc
.. include:: /reference/forms/types/options/trim.rst.inc

* .. include:: /reference/forms/types/options/property_path.rst.inc
.. include:: /reference/forms/types/options/property_path.rst.inc
15 changes: 15 additions & 0 deletions reference/forms/types/options/data.rst.inc
@@ -0,0 +1,15 @@
* ``data`` [type: any, default: the field's initial value]
When you create a form, each field initially displays the value of the
corresponding property of the form's domain object. If you want to override
this initial value, you can set it in the data option.

.. code-block:: php

use Symfony\Component\Form\HiddenField

$field = new HiddenField('token', array(
'data' => 'abcdef',
));
assert('abcdef' === $field->getData());


17 changes: 17 additions & 0 deletions reference/forms/types/options/disabled.rst.inc
@@ -0,0 +1,17 @@
* ``disabled`` [type: Boolean, default: false]
If you don't want a user to modify the value of a field, you can set
the disabled option to true. Any submitted value will be ignored.

.. code-block:: php

use Symfony\Component\Form\TextField

$field = new TextField('status', array(
'data' => 'Old data',
'disabled' => true,
));
$field->submit('New data');

assert('Old data' === $field->getData());


0 comments on commit 4f23b87

Please sign in to comment.