From 1a03f4ba0526f34c822a9308a8929571b9ef77d4 Mon Sep 17 00:00:00 2001 From: BigBenJr <40687277+BigBenJr@users.noreply.github.com> Date: Mon, 7 Apr 2025 19:56:15 +0300 Subject: [PATCH] Update 'Submitting the Form via a LiveAction' Add explanation about action:prevent --- src/LiveComponent/doc/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/LiveComponent/doc/index.rst b/src/LiveComponent/doc/index.rst index a473881d50b..9f18b0a0453 100644 --- a/src/LiveComponent/doc/index.rst +++ b/src/LiveComponent/doc/index.rst @@ -1552,7 +1552,8 @@ Next, tell the ``form`` element to use this action: } }) }} -Now, when the form is submitted, it will execute the ``save()`` method +Now, when the form is submitted, the ``live#action:prevent`` catches the form submission event and prevents the regular HTTP form submission. +it will execute the ``save()`` method via Ajax. If the form fails validation, it will re-render with the errors. And if it's successful, it will redirect.