Skip to content

Commit

Permalink
add separate placeholder examples for birthday, datetime and time type
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Snoek authored and xabbuh committed Feb 6, 2016
1 parent 52cd29b commit 70852c8
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 9 deletions.
26 changes: 25 additions & 1 deletion reference/forms/types/birthday.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,31 @@ type:

.. include:: /reference/forms/types/options/days.rst.inc

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('birthdate', 'birthday', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the year, month and day fields::

$builder->add('birthdate', 'birthday', array(
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
)
));

.. include:: /reference/forms/types/options/date_format.rst.inc

Expand Down
15 changes: 9 additions & 6 deletions reference/forms/types/date.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,23 @@ placeholder
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` or ``array``
**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. The ``placeholder`` option can be used
to add a "blank" entry to the top of each select box::
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('dueDate', 'date', array(
'placeholder' => '',
'placeholder' => 'Select a value',
));

Alternatively, you can specify a string to be displayed for the "blank" value::
Alternatively, you can use an array that configures different placeholder
values for the year, month and day fields::

$builder->add('dueDate', 'date', array(
'placeholder' => array('year' => 'Year', 'month' => 'Month', 'day' => 'Day')
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day'
)
));

.. _reference-forms-type-date-format:
Expand Down
27 changes: 26 additions & 1 deletion reference/forms/types/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,32 @@ date_widget

.. include:: /reference/forms/types/options/days.rst.inc

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('startDateTime', 'datetime', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the year, month, day, hour, minute and second fields::

$builder->add('startDateTime', 'datetime', array(
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
)
));

format
~~~~~~
Expand Down
26 changes: 25 additions & 1 deletion reference/forms/types/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,31 @@ values.
Field Options
-------------

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('startTime', 'time', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the hour, minute and second fields::

$builder->add('startTime', 'time', array(
'placeholder' => array(
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
)
));

.. include:: /reference/forms/types/options/hours.rst.inc

Expand Down

0 comments on commit 70852c8

Please sign in to comment.