Disabled after submit
All checks were successful
Deploy / build-and-publish (push) Successful in 1m19s
Deploy / deploy (push) Successful in 13s

This commit is contained in:
2024-09-29 18:32:26 +03:00
parent 0e72c78174
commit 10d1793d16

View File

@@ -37,6 +37,7 @@ $: errorSlugs = ((): {
$: invalid = Object.values(errorSlugs).some(slug => slug !== null) $: invalid = Object.values(errorSlugs).some(slug => slug !== null)
const handleSubmit = () => { const handleSubmit = () => {
if (submitted) return
attemptedSubmit = true attemptedSubmit = true
if (invalid) return if (invalid) return
@@ -73,6 +74,7 @@ const handleSubmit = () => {
autocomplete="off" autocomplete="off"
bind:value={form.message} bind:value={form.message}
class="md:h-full" class="md:h-full"
disabled={submitted}
></textarea> ></textarea>
{#if attemptedSubmit && errorSlugs.message} {#if attemptedSubmit && errorSlugs.message}
<span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.message)}</span> <span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.message)}</span>
@@ -87,6 +89,7 @@ const handleSubmit = () => {
type="text" type="text"
autocomplete="off" autocomplete="off"
bind:value={form.name} bind:value={form.name}
disabled={submitted}
/> />
{#if attemptedSubmit && errorSlugs.name} {#if attemptedSubmit && errorSlugs.name}
<span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.name)}</span> <span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.name)}</span>
@@ -99,6 +102,7 @@ const handleSubmit = () => {
type="email" type="email"
autocomplete="off" autocomplete="off"
bind:value={form.email} bind:value={form.email}
disabled={submitted}
/> />
{#if attemptedSubmit && errorSlugs.email} {#if attemptedSubmit && errorSlugs.email}
<span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.email)}</span> <span class="text-sm text-red-500 absolute top-full">{$t(errorSlugs.email)}</span>