mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-20 12:58:34 +00:00
feat: ignore submit enter on page with SchoolSelect
This commit is contained in:
parent
cc5fa60c62
commit
bcc8d38f09
2 changed files with 17 additions and 4 deletions
|
|
@ -1,12 +1,13 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let enterAllowed: boolean;
|
||||
export let value: string;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Enter') {
|
||||
if (enterAllowed && e.key === 'Enter') {
|
||||
dispatch('click');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
import LinkErrorModal from '$lib/components/modal/LinkErrorModal.svelte';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import schoollistString from '$lib/assets/schoollist.txt?raw';
|
||||
import { countries } from '$lib/utils/countries';
|
||||
import { pushErrorText } from '$lib/utils/toast';
|
||||
|
||||
let pageIndex = 0;
|
||||
let pagesFilled = [false, false, false, false, false, false, false, false];
|
||||
|
|
@ -154,7 +154,12 @@
|
|||
.required()
|
||||
.test((_val) => {
|
||||
if (!_val) return false;
|
||||
return schoolList.includes(_val);
|
||||
if (schoolList.includes(_val)) {
|
||||
return true;
|
||||
} else {
|
||||
pushErrorText("Vyberte prosím školu ze seznamu.");
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
field: yup.string().required()
|
||||
}),
|
||||
|
|
@ -164,7 +169,13 @@
|
|||
.required()
|
||||
.test((_val) => {
|
||||
if (!_val) return false;
|
||||
return schoolList.includes(_val);
|
||||
if (!_val) return false;
|
||||
if (schoolList.includes(_val)) {
|
||||
return true;
|
||||
} else {
|
||||
pushErrorText("Vyberte prosím školu ze seznamu.");
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
field: yup.string().required()
|
||||
}),
|
||||
|
|
@ -788,6 +799,7 @@
|
|||
<div class="bottom-1/24 absolute w-full">
|
||||
<div class="field">
|
||||
<Submit
|
||||
enterAllowed={pageIndex !== 7}
|
||||
on:click={async (e) => {
|
||||
if (pageIndex === 4) {
|
||||
validatePersonalId();
|
||||
|
|
|
|||
Loading…
Reference in a new issue