Forms docs: More emphasis in 'id' value customizability.

This commit is contained in:
Ramiro Morales 2013-10-12 13:27:02 -03:00
parent 21c2bfdff3
commit 18ea1c473b
1 changed files with 19 additions and 13 deletions

View File

@ -408,21 +408,27 @@ classes, as needed. The HTML will look something like::
.. _ref-forms-api-configuring-label: .. _ref-forms-api-configuring-label:
Configuring HTML ``<label>`` tags Configuring form elements' HTML ``id`` attributes and ``<label>`` tags
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An HTML ``<label>`` tag designates which label text is associated with which .. attribute:: Form.auto_id
form element. This small enhancement makes forms more usable and more accessible
to assistive devices. It's always a good idea to use ``<label>`` tags.
By default, the form rendering methods include HTML ``id`` attributes on the By default, the form rendering methods include:
form elements and corresponding ``<label>`` tags around the labels. The ``id``
attribute values are generated by prepending ``id_`` to the form field names.
This behavior is configurable, though, if you want to change the ``id``
convention or remove HTML ``id`` attributes and ``<label>`` tags entirely.
Use the ``auto_id`` argument to the ``Form`` constructor to control the label * HTML ``id`` attributes on the form elements.
and ``id`` behavior. This argument must be ``True``, ``False`` or a string.
* The corresponding ``<label>`` tags around the labels. An HTML ``<label>`` tag
designates which label text is associated with which form element. This small
enhancement makes forms more usable and more accessible to assistive devices.
It's always a good idea to use ``<label>`` tags.
The ``id`` attribute values are generated by prepending ``id_`` to the form
field names. This behavior is configurable, though, if you want to change the
``id`` convention or remove HTML ``id`` attributes and ``<label>`` tags
entirely.
Use the ``auto_id`` argument to the ``Form`` constructor to control the ``id``
and label behavior. This argument must be ``True``, ``False`` or a string.
If ``auto_id`` is ``False``, then the form output will not include ``<label>`` If ``auto_id`` is ``False``, then the form output will not include ``<label>``
tags nor ``id`` attributes:: tags nor ``id`` attributes::