Skip to content

Commit 44d19de

Browse files
ThomasLandauerwouterj
authored andcommitted
Added example for 'required' => false
| Q | A | ------------- | --- | Doc fix? | [yes] | New docs? | [no] | Applies to | [2.3] | Fixed tickets | []
1 parent ebb1e74 commit 44d19de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

book/forms.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,12 @@ the documentation for each type.
679679
The most common option is the ``required`` option, which can be applied to
680680
any field. By default, the ``required`` option is set to ``true``, meaning
681681
that HTML5-ready browsers will apply client-side validation if the field
682-
is left blank. If you don't want this behavior, either set the ``required``
683-
option on your field to ``false`` or
684-
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`.
682+
is left blank. If you don't want this behavior, either
683+
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`
684+
or set the ``required`` option on your field to ``false``:
685+
686+
->add('dueDate', 'date', array('widget' => 'single_text',
687+
'required' => false))
685688

686689
Also note that setting the ``required`` option to ``true`` will **not**
687690
result in server-side validation to be applied. In other words, if a

0 commit comments

Comments
 (0)