From cf48e1aea6ebd45052c1b90bfd783869e6ebfe7c Mon Sep 17 00:00:00 2001 From: William Pinaud Date: Mon, 6 Jan 2025 15:18:25 +0100 Subject: [PATCH 1/2] Update index.rst Added info for form submission inputs --- src/Turbo/doc/index.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 4618bd701c2..78e9335450e 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -179,6 +179,26 @@ situation. ] ]); + +4. Flash Messages and forward-fetching side effects +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Of course, if you have side effects, like added `Flash Messages `_ +to your form submissions, they will be flushed during the asynchronous call. +To prevent such actions on form submissions to be executed ahead of time +(like emptying a FlashBag of session messages), the best way is +to simply disable Turbo Drive on submission inputs/buttons +(which are tried on hover by default). + +Simply add a ``data-turbo="false"`` attribute and value to your widgets: + +.. code-block:: html + + + +This way, only your real user manual action will trigger the form submission. +More information can be found in the Turbo documentation: https://turbo.hotwired.dev/reference/attributes. + More Turbo Drive Info ^^^^^^^^^^^^^^^^^^^^^ From 050ec4f56dad4d628ffa2716255774292ee5cdba Mon Sep 17 00:00:00 2001 From: William Pinaud Date: Mon, 6 Jan 2025 15:23:44 +0100 Subject: [PATCH 2/2] Update index.rst --- src/Turbo/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 78e9335450e..3dc8ed898d5 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -181,7 +181,7 @@ situation. 4. Flash Messages and forward-fetching side effects -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Of course, if you have side effects, like added `Flash Messages `_ to your form submissions, they will be flushed during the asynchronous call.