From 79488e6c6be3af7320acdd71eb1ff7624d25bc86 Mon Sep 17 00:00:00 2001 From: Bernhard Baumrock Date: Tue, 21 Mar 2023 10:32:04 +0100 Subject: [PATCH] Add "success" event on successful form submit This makes it possible to add CSS classes on successful form submit so that - for example - one can animate the submit button while the form is sending data. --- live-form-validation.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/live-form-validation.js b/live-form-validation.js index 5df8088..0b18ddf 100644 --- a/live-form-validation.js +++ b/live-form-validation.js @@ -1183,7 +1183,9 @@ if (!Nette.validateForm(form)) { e.stopPropagation(); e.preventDefault(); + return; } + form.dispatchEvent(new Event("success")); }); // LiveForm: addition