Skip to content

Commit 8561baa

Browse files
Added example for 'required' => false
| Q | A | ------------- | --- | Doc fix? | [yes] | New docs? | [no] | Applies to | [2.3] | Fixed tickets | []
1 parent 52dcecd commit 8561baa

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
@@ -669,9 +669,12 @@ the documentation for each type.
669669
The most common option is the ``required`` option, which can be applied to
670670
any field. By default, the ``required`` option is set to ``true``, meaning
671671
that HTML5-ready browsers will apply client-side validation if the field
672-
is left blank. If you don't want this behavior, either set the ``required``
673-
option on your field to ``false`` or
674-
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`.
672+
is left blank. If you don't want this behavior, either
673+
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`
674+
or set the ``required`` option on your field to ``false``:
675+
676+
->add('dueDate', 'date', array('widget' => 'single_text',
677+
'required' => false))
675678

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

0 commit comments

Comments
 (0)