summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/forms/widgets.txt22
-rw-r--r--docs/releases/5.2.txt3
2 files changed, 25 insertions, 0 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index bd970f1517..0a7a415583 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -580,6 +580,28 @@ These widgets make use of the HTML elements ``input`` and ``textarea``.
* ``template_name``: ``'django/forms/widgets/search.html'``
* Renders as: ``<input type="search" ...>``
+``TelInput``
+~~~~~~~~~~~~~~
+
+.. versionadded:: 5.2
+
+.. class:: TelInput
+
+ * ``input_type``: ``'tel'``
+ * ``template_name``: ``'django/forms/widgets/tel.html'``
+ * Renders as: ``<input type="tel" ...>``
+
+ Browsers perform no client-side validation by default because telephone
+ number formats vary so much around the world. You can add some by setting
+ ``pattern``, ``minlength``, or ``maxlength`` in the :attr:`Widget.attrs`
+ argument.
+
+ Additionally, you can add server-side validation to your form field with a
+ validator like :class:`~django.core.validators.RegexValidator` or via
+ third-party packages, such as `django-phonenumber-field`_.
+
+.. _django-phonenumber-field: https://django-phonenumber-field.readthedocs.io/en/latest/index.html
+
``PasswordInput``
~~~~~~~~~~~~~~~~~
diff --git a/docs/releases/5.2.txt b/docs/releases/5.2.txt
index cb57b9255c..60794ac8ed 100644
--- a/docs/releases/5.2.txt
+++ b/docs/releases/5.2.txt
@@ -173,6 +173,9 @@ Forms
* The new :class:`~django.forms.SearchInput` form widget is for entering search
queries and renders as ``<input type="search" ...>``.
+* The new :class:`~django.forms.TelInput` form widget is for entering telephone
+ numbers and renders as ``<input type="tel" ...>``.
+
Generic Views
~~~~~~~~~~~~~