Skip to content

Commit

Permalink
Added example for 'required' => false
Browse files Browse the repository at this point in the history
| Q             | A
| ------------- | ---
| Doc fix?      | [yes]
| New docs?     | [no]
| Applies to    | [2.3]
| Fixed tickets | []
  • Loading branch information
ThomasLandauer authored and wouterj committed Dec 19, 2015
1 parent ebb1e74 commit 44d19de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,12 @@ the documentation for each type.
The most common option is the ``required`` option, which can be applied to
any field. By default, the ``required`` option is set to ``true``, meaning
that HTML5-ready browsers will apply client-side validation if the field
is left blank. If you don't want this behavior, either set the ``required``
option on your field to ``false`` or
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`.
is left blank. If you don't want this behavior, either
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>`
or set the ``required`` option on your field to ``false``:

->add('dueDate', 'date', array('widget' => 'single_text',
'required' => false))

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

0 comments on commit 44d19de

Please sign in to comment.