Skip to content

Commit 7665a6b

Browse files
committed
minor #13824 Improve the Best Practice about forms with multiple buttons (javiereguiluz)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Improve the Best Practice about forms with multiple buttons Fixes #13563. Commits ------- d80dbb4 Improve the Best Practice about forms with multiple buttons
2 parents 4533004 + d80dbb4 commit 7665a6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

best_practices.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ to add buttons in the templates. This also improves the separation of concerns,
299299
because the button styling (CSS class and other attributes) is defined in the
300300
template instead of in a PHP class.
301301

302+
However, if you create a :doc:`form with multiple submit buttons </form/multiple_buttons>`
303+
you should define them in the controller instead of the template. Otherwise, you
304+
won't be able to check which button was clicked when handling the form in the controller.
305+
302306
Define Validation Constraints on the Underlying Object
303307
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304308

0 commit comments

Comments
 (0)