|
@@ -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``
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|