From 0fb193ec427ab9b1d4d85c02f49feeaceb9800d9 Mon Sep 17 00:00:00 2001 From: Jeffery <61447509+jeffplays2005@users.noreply.github.com> Date: Sat, 20 Jul 2024 15:44:07 +1200 Subject: [PATCH] 611 Signup validation (#647) * Validate emergency contact Require at least 3 items split by a comma. * Changed emergency contact validation --- client/src/store/SignUpForm.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/store/SignUpForm.tsx b/client/src/store/SignUpForm.tsx index 72f57b75a..d1d4e0df4 100644 --- a/client/src/store/SignUpForm.tsx +++ b/client/src/store/SignUpForm.tsx @@ -54,7 +54,8 @@ const actions = { } const validateContactSection = (invalidFields: string[]) => { - const { email, confirmEmail, phone_number } = getState() + const { email, confirmEmail, phone_number, emergency_contact } = + getState() const validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/ @@ -67,6 +68,9 @@ const actions = { if (phone_number.toString().length < 6) { invalidFields.push("Phone Number") } + if (emergency_contact === "") { + invalidFields.push("Emergency Contact") + } } switch (pageToValidate) {