mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-18 22:11:14 +00:00
fix: parent telephone validation
This commit is contained in:
parent
c8ced5f79d
commit
911a5f6ee2
1 changed files with 6 additions and 8 deletions
|
|
@ -185,12 +185,7 @@
|
|||
}
|
||||
return _val !== '';
|
||||
}),
|
||||
telephone: yup.string().test((_val, context) => {
|
||||
if (context.path.includes('parents[1]') && _val === '') {
|
||||
return true;
|
||||
}
|
||||
return _val?.match(/^\+\d{1,3} \d{3} \d{3} \d{3}$/) !== null;
|
||||
})
|
||||
telephone: yup.string()
|
||||
})
|
||||
)
|
||||
});
|
||||
|
|
@ -222,6 +217,9 @@
|
|||
};
|
||||
|
||||
const onSubmit = async (values: CandidateData) => {
|
||||
console.log("submit button clicked");
|
||||
console.log(pagesFilled.map((_, i) => !isPageInvalid(i)));
|
||||
|
||||
if (pageIndex === 3) {
|
||||
if (values.candidate.citizenship === 'Česká republika') {
|
||||
if (
|
||||
|
|
@ -297,7 +295,6 @@
|
|||
|
||||
onSubmit: async (values: CandidateData) => onSubmit(values)
|
||||
});
|
||||
$: console.log($componentErrors['candidate']['telephone'])
|
||||
const isPageInvalid = (index: number): boolean => {
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
|
@ -541,7 +538,7 @@
|
|||
placeholder={$LL.input.email()}
|
||||
/>
|
||||
</span>
|
||||
<span class="w-[50%]">
|
||||
<span class="w-[50%] ml-2">
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['city']}
|
||||
bind:value={$form.candidate.city}
|
||||
|
|
@ -763,6 +760,7 @@
|
|||
<Submit
|
||||
on:click={async (e) => {
|
||||
await handleSubmit(e);
|
||||
console.log(pagesFilled.map((_, i) => !isPageInvalid(i)));
|
||||
if (isPageInvalid(pageIndex)) return;
|
||||
if (pageIndex === pageCount) {
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue