Disabled after submit
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user