Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions reference/forms/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Form Types Reference
types/percent
types/search
types/url
types/range

types/choice
types/entity
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Text Fields
* :doc:`percent </reference/forms/types/percent>`
* :doc:`search </reference/forms/types/search>`
* :doc:`url </reference/forms/types/url>`
* :doc:`range </reference/forms/types/range>`

Choice Fields
~~~~~~~~~~~~~
Expand Down
74 changes: 74 additions & 0 deletions reference/forms/types/range.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.. index::
single: Forms; Fields; range

range Field Type
================

The ``range`` field is a slider that is rendered using the HTML5
``<input type="range" />`` tag.

+-------------+---------------------------------------------------------------------+
| Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) |
+-------------+---------------------------------------------------------------------+
| Inherited | - `attr`_ |
| options | - `data`_ |
| | - `disabled`_ |
| | - `empty_data`_ |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add include for empty_data option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @snoek09 actually I have a question regarding the inherited options and include. I actually copied this from email.rst or something I guess. So is it all the properties of the text field for it is parent the properties are imported ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EmailType and RangeType both have the same type as a parent; text (TextType).

The parent type of text is form (FormType).
The inherited options are from this form type:

http://symfony.com/doc/current/reference/forms/types/text.html

Copy link
Contributor Author

@harikt harikt Jun 30, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `mapped`_ |
| | - `required`_ |
| | - `trim`_ |
+-------------+---------------------------------------------------------------------+
| Parent type | :doc:`text </reference/forms/types/text>` |
+-------------+---------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` |
+-------------+---------------------------------------------------------------------+

Basic Usage
-----------

.. code-block:: php

$builder->add('name', 'range', array(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a code-block directive before the example code:

.. code-block:: php

    $builder->add('name', 'range', array(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. Thanks.

'attr' => array(
'min' => 5,
'max' => 50
)
));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove one of the blank lines.

Inherited Options
-----------------

These options inherit from the :doc:`form </reference/forms/types/form>`
type:

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

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

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

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data.rst.inc
:start-after: DEFAULT_PLACEHOLDER

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

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

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

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

.. include:: /reference/forms/types/options/label_attr.rst.inc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description should be moved before the mapped option's description.


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

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