fix: not working submit, show all forms (without doing anything)

This commit is contained in:
Sebastian Pravda 2022-11-29 14:28:33 +01:00 committed by EETagent
parent c4e5a88192
commit ed51ae97d1

View file

@ -61,14 +61,18 @@
}), }),
onSubmit: async (values) => { onSubmit: async (values) => {
console.log("submit") if (pageIndex === pageCount) {
// @ts-ignore // love javascript try {
delete values.undefined; console.log("submit")
// @ts-ignore // love javascript
values.birthdate = '2000-01-01' // TODO: reformat user typed date delete values.undefined;
values.birthdate = '2000-01-01' // TODO: reformat user typed date
await fillDetails(values); await fillDetails(values);
goto("/dashboard"); goto("/dashboard");
} catch (e) {
console.error("error while submitting data: " + e);
}
}
}, },
}); });
@ -157,13 +161,11 @@
</p> </p>
<div class="flex flex-row md:flex-col w-full"> <div class="flex flex-row md:flex-col w-full">
<span class="w-full mt-8"> <span class="w-full mt-8">
<!-- <TextField <TextField
type="text" type="text"
placeholder="Rodné příjmení" placeholder="Rodné příjmení"
error={$errors.birthSurname}
on:change={handleChange} on:change={handleChange}
bind:value={$form.birthSurname} />
/> -->
</span> </span>
<span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField
@ -189,7 +191,7 @@
type="text" type="text"
placeholder="Datum narození" placeholder="Datum narození"
/> />
<!-- <div class="ml-2"> <div class="ml-2">
<TextField <TextField
error={$errors.sex} error={$errors.sex}
on:change={handleChange} on:change={handleChange}
@ -197,7 +199,7 @@
type="text" type="text"
placeholder="Pohlaví" placeholder="Pohlaví"
/> />
</div> --> </div>
</div> </div>
{/if} {/if}
{#if pageIndex === 2} {#if pageIndex === 2}
@ -250,15 +252,13 @@
placeholder="Občanství" placeholder="Občanství"
/> />
</span> </span>
<!-- <span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField
error={$errors.applicationId}
on:change={handleChange} on:change={handleChange}
bind:value={$form.applicationId}
type="text" type="text"
placeholder="Evidenční číslo přihlášky" placeholder="Evidenční číslo přihlášky"
/> />
</span> --> </span>
</div> </div>
<div class="mt-8 flex items-center justify-center w-full"> <div class="mt-8 flex items-center justify-center w-full">
<IdField <IdField
@ -280,9 +280,10 @@
{/if} {/if}
<input <input
on:click={async (e) => { on:click={async (e) => {
await handleSubmit(e);
console.log("clicked " + isPageInvalid());
if (isPageInvalid()) return; if (isPageInvalid()) return;
if (pageIndex === pageCount) { if (pageIndex === pageCount) {
await handleSubmit(e);
} else { } else {
pagesFilled++; pagesFilled++;
pageIndex++; pageIndex++;