From 911a5f6ee2e1d48a1b2c67b983c3f1dd003e3c76 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Thu, 2 Feb 2023 18:34:33 +0100 Subject: [PATCH] fix: parent telephone validation --- .../(authenticated)/register/+page.svelte | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index af56e7b..111a235 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -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()} /> - + { await handleSubmit(e); + console.log(pagesFilled.map((_, i) => !isPageInvalid(i))); if (isPageInvalid(pageIndex)) return; if (pageIndex === pageCount) { } else {