summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
authorlucasesposito <espositolucas95@gmail.com>2024-07-19 01:26:46 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-08-02 11:31:54 +0200
commitb478cae00643d6730746f2614792b35a7d3187ff (patch)
tree92360f651e77202c741db8640e268b6b660f4f83 /docs/ref/forms
parent946c3cf7342cc40c2d8e3d865c96a4ec990f76f4 (diff)
Fixed #35601 -- Added TelInput widget.
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/widgets.txt22
1 files changed, 22 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``
~~~~~~~~~~~~~~~~~