From 54752a50d30fa5ab517a6e85e807da12648a2aff Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 21:26:24 +0100 Subject: [PATCH] fix: parent's email, telephone validation --- .../(candidate)/(authenticated)/register/+page.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index 14b9cdf..5cb205e 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -71,7 +71,7 @@ gdpr: yup.boolean().oneOf([true]), candidate: yup.object().shape({ name: yup.string().required(), - surname: yup.string(), + surname: yup.string().required(), email: yup.string().email().required(), telephone: yup .string() @@ -106,13 +106,13 @@ .string() .email() .test((_val, context) => { - if (context.path.includes('parents[1]')) { + if (context.path.includes('parents[1]') && _val === '') { return true; } return _val !== ''; }), telephone: yup.string().test((_val, context) => { - if (context.path.includes('parents[1]')) { + if (context.path.includes('parents[1]') && _val === '') { return true; } return _val?.match(/^\+\d{1,3} \d{3} \d{3} \d{3}$/) !== null;