Skip to content

Commit 3ba761d

Browse files
committed
minor #8103 Update form best practises regarding Form::isValid (paulferrett)
This PR was submitted for the 3.3 branch but it was merged into the 3.2 branch instead (closes #8103). Discussion ---------- Update form best practises regarding Form::isValid This small change updates the form best practises to reflect the fact that calling `Form::isValid()` with an unsubmitted form is deprecated since version 3.2 and will throw an exception in 4.0. Commits ------- e4ec7bd Update form best practises regarding Form::isValid
2 parents 386156b + e4ec7bd commit 3ba761d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

best_practices/forms.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ and a ``createAction()`` that *only* processes the form submit. Both those
204204
actions will be almost identical. So it's much simpler to let ``newAction()``
205205
handle everything.
206206

207-
Second, we recommend using ``$form->isSubmitted()`` in the ``if`` statement
208-
for clarity. This isn't technically needed, since ``isValid()`` first calls
209-
``isSubmitted()``. But without this, the flow doesn't read well as it *looks*
210-
like the form is *always* processed (even on the GET request).
207+
Second, is it required to call ``$form->isSubmitted()`` in the ``if`` statement
208+
before calling ``isValid()``. Calling ``isValid()`` with an unsubmitted form
209+
is deprecated since version 3.2 and will throw an exception in 4.0.

0 commit comments

Comments
 (0)