Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d150185

Browse files
committed
[reference][forms] Quickly adding missing empty_value date option
1 parent 6873534 commit d150185

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

reference/forms/types/date.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ day, and year) or three select boxes (see the `widget_` option).
2121
+----------------------+-----------------------------------------------------------------------------+
2222
| Options | - `widget`_ |
2323
| | - `input`_ |
24+
| | - `empty_value`_ |
2425
| | - `years`_ |
2526
| | - `months`_ |
2627
| | - `days`_ |
@@ -74,6 +75,25 @@ Field Options
7475

7576
.. include:: /reference/forms/types/options/date_input.rst.inc
7677

78+
empty_value
79+
~~~~~~~~~~~
80+
81+
**type**: ``string``|``array``
82+
83+
If your widget option is set to ``choice``, then this field will be represented
84+
as a series of ``select`` boxes. The ``empty_value`` option can be used to
85+
add a "blank" entry to the top of each select box::
86+
87+
$builder->add('dueDate', 'date', array(
88+
'empty_value' => '',
89+
));
90+
91+
Alternatively, you can specify a string to be displayed for the "blank" value::
92+
93+
$builder->add('dueDate', 'date', array(
94+
'empty_value' => array('year' => 'Year', 'month' => 'Month', 'day' => 'Day')
95+
));
96+
7797
.. include:: /reference/forms/types/options/years.rst.inc
7898

7999
.. include:: /reference/forms/types/options/months.rst.inc

0 commit comments

Comments
 (0)