From 10d1793d166213adabf7648833265c20b6008a25 Mon Sep 17 00:00:00 2001 From: Anatoly Kopyl Date: Sun, 29 Sep 2024 18:32:26 +0300 Subject: [PATCH] Disabled after submit --- src/routes/ContactForm/ContactForm.svelte | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routes/ContactForm/ContactForm.svelte b/src/routes/ContactForm/ContactForm.svelte index 6c31851..33c2f95 100644 --- a/src/routes/ContactForm/ContactForm.svelte +++ b/src/routes/ContactForm/ContactForm.svelte @@ -37,6 +37,7 @@ $: errorSlugs = ((): { $: invalid = Object.values(errorSlugs).some(slug => slug !== null) const handleSubmit = () => { + if (submitted) return attemptedSubmit = true if (invalid) return @@ -73,6 +74,7 @@ const handleSubmit = () => { autocomplete="off" bind:value={form.message} class="md:h-full" + disabled={submitted} > {#if attemptedSubmit && errorSlugs.message} {$t(errorSlugs.message)} @@ -87,6 +89,7 @@ const handleSubmit = () => { type="text" autocomplete="off" bind:value={form.name} + disabled={submitted} /> {#if attemptedSubmit && errorSlugs.name} {$t(errorSlugs.name)} @@ -99,6 +102,7 @@ const handleSubmit = () => { type="email" autocomplete="off" bind:value={form.email} + disabled={submitted} /> {#if attemptedSubmit && errorSlugs.email} {$t(errorSlugs.email)}