minor Form fixes

This commit is contained in:
Samuel Andert 2023-08-08 10:59:46 +02:00
parent d3d181d625
commit 3b0640875e

View File

@ -72,7 +72,13 @@
},
submitting: {
on: {
SUBMIT: 'submitted'
SUBMIT: 'submitted',
PREV: {
target: 'input',
actions: assign({
currentField: (context) => context.currentField - 1
})
}
}
},
submitted: {
@ -119,6 +125,7 @@
<div class="p-6">
<form on:submit|preventDefault={handleNext} on:keydown={handleKeyDown} class="w-full max-w-md">
{#if !$state.matches('submitting')}
<div class="mb-4">
{#if $errors[fields[$state.context.currentField].name]}
<span class="block mb-2 font-semibold text-red-500">
@ -149,6 +156,7 @@
<NumberInput {childInput} />
{/if}
</div>
{/if}
{#if $state.matches('submitting')}
<div class="mb-4">
<h2 class="text-lg font-semibold text-white">Summary</h2>