diff options
| author | David <smithdc@gmail.com> | 2022-01-13 23:08:38 +0000 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2022-03-30 16:28:14 +0200 |
| commit | c8459708a7e0a2474255b77d0f104a7f16e8b32c (patch) | |
| tree | add60b1d21cfaa37e51c116348054e71c91f73a1 /docs/topics/forms | |
| parent | 04ad0f26ba4b8c79dc311e1789457e0c4d1b8832 (diff) | |
Refs #32339 -- Added use_fieldset to Widget.
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/index.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index d87b9be8d6..2d0d61aa02 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -686,6 +686,32 @@ Useful attributes on ``{{ field }}`` include: <label for="id_email">Email address:</label> +``{{ field.legend_tag }}`` + + .. versionadded:: 4.1 + + Similar to ``field.label_tag`` but uses a ``<legend>`` tag in place of + ``<label>``, for widgets with multiple inputs wrapped in a ``<fieldset>``. + +``{{ field.use_fieldset }}`` + + .. versionadded:: 4.1 + + This attribute is ``True`` if the form field's widget contains multiple + inputs that should be semantically grouped in a ``<fieldset>`` with a + ``<legend>`` to improve accessibility. An example use in a template: + +.. code-block:: html+django + + {% if field.use_fieldset %} + <fieldset> + {% if field.label %}{{ field.legend_tag }}{% endif %} + {% else %} + {% if field.label %}{{ field.label_tag }}{% endif %} + {% endif %} + {{ field }} + {% if field.use_fieldset %}</fieldset>{% endif %} + ``{{ field.value }}`` The value of the field. e.g ``someone@example.com``. |
