From 3b0640875e22b4e63e64e3b7a0fb3d74f8462323 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Tue, 8 Aug 2023 10:59:46 +0200 Subject: [PATCH] minor Form fixes --- .../components/refactor/ComposerForm.svelte | 70 +++++++++++-------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/lib/components/refactor/ComposerForm.svelte b/src/lib/components/refactor/ComposerForm.svelte index 343769f..950fdc8 100644 --- a/src/lib/components/refactor/ComposerForm.svelte +++ b/src/lib/components/refactor/ComposerForm.svelte @@ -72,7 +72,13 @@ }, submitting: { on: { - SUBMIT: 'submitted' + SUBMIT: 'submitted', + PREV: { + target: 'input', + actions: assign({ + currentField: (context) => context.currentField - 1 + }) + } } }, submitted: { @@ -119,36 +125,38 @@
-
- {#if $errors[fields[$state.context.currentField].name]} - - {$errors[fields[$state.context.currentField].name]} - - {:else} - - {/if} - {#if fields[$state.context.currentField].type === 'text'} - - {:else if fields[$state.context.currentField].type === 'email'} - - {:else if fields[$state.context.currentField].type === 'textarea'} - - {:else if fields[$state.context.currentField].type === 'select'} - - {:else if fields[$state.context.currentField].type === 'slider'} - - {:else if fields[$state.context.currentField].type === 'toggle'} - - {:else if fields[$state.context.currentField].type === 'number'} - - {/if} -
+ {#if !$state.matches('submitting')} +
+ {#if $errors[fields[$state.context.currentField].name]} + + {$errors[fields[$state.context.currentField].name]} + + {:else} + + {/if} + {#if fields[$state.context.currentField].type === 'text'} + + {:else if fields[$state.context.currentField].type === 'email'} + + {:else if fields[$state.context.currentField].type === 'textarea'} + + {:else if fields[$state.context.currentField].type === 'select'} + + {:else if fields[$state.context.currentField].type === 'slider'} + + {:else if fields[$state.context.currentField].type === 'toggle'} + + {:else if fields[$state.context.currentField].type === 'number'} + + {/if} +
+ {/if} {#if $state.matches('submitting')}

Summary