From be1559a271f38ee2d31c9d196ce31b2a4380ab61 Mon Sep 17 00:00:00 2001 From: Nshuti Parfait Date: Wed, 8 Nov 2023 15:37:14 +0200 Subject: [PATCH] fix: Input Validation (#334) - ensure coordinator can not submit form with empty fields [fixes #315] --- public/locales/fr/translation.json | 3 ++- public/locales/kn/translation.json | 3 ++- src/pages/AdminTraineeDashboard.tsx | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index b1aabf837..7067f0999 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -462,5 +462,6 @@ "Provide Quantity range between 1-2": "Fournir une gamme de quantité comprise entre 1-2", "Provide Professional_Skills range between 1-2": "Fournir une gamme de compétences professionnelles comprise entre 1-2", "Sprint Ratings": "Sprint Notations", - "Please wait to be added to a program or cohort":"Veuillez attendre d'être ajouté à un programme ou à une cohorte" + "Please wait to be added to a program or cohort":"Veuillez attendre d'être ajouté à un programme ou à une cohorte", + "Enter all the required information":"Entrez toutes les informations requises" } diff --git a/public/locales/kn/translation.json b/public/locales/kn/translation.json index 6d4a22ebc..04b333ace 100644 --- a/public/locales/kn/translation.json +++ b/public/locales/kn/translation.json @@ -449,5 +449,6 @@ "Provide Quantity range between 1-2": "Tanga Umubare uri hagati ya 1-2", "Provide Professional_Skills range between 1-2": "Tanga ubuhanga buri hagati ya 1-2", "Sprint Ratings": "Amanota ya Sprint", - "Please wait to be added to a program or cohort": "Tegereza tukongere muri porogarame cyangwa itsinda" + "Please wait to be added to a program or cohort": "Tegereza tukongere muri porogarame cyangwa itsinda", + "Enter all the required information": "Shyiramo amakuru yose asabwa" } diff --git a/src/pages/AdminTraineeDashboard.tsx b/src/pages/AdminTraineeDashboard.tsx index a910ad2fa..53d26630b 100644 --- a/src/pages/AdminTraineeDashboard.tsx +++ b/src/pages/AdminTraineeDashboard.tsx @@ -1237,8 +1237,12 @@ function AdminTraineeDashboard() { data-testid="saveButton" style="w-[30%] md:w-1/4 text-sm font-sans" onClick={() => { - setButtonLoading(true); - addMemberToTeam(); + if (Object.values(email)[1] && Object.values(selectedOption)[1] && Object.values(selectedTeamOption)[1]) { + setButtonLoading(true); + addMemberToTeam(); + } else if (!Object.values(email)[1] || !Object.values(selectedOption)[1] || !Object.values(selectedTeamOption)[1]) { + toast.error(t("Enter all the required information")); + } }} loading={buttonLoading} >