From 64670923e15a080356edba62caa4f71879fa9ee0 Mon Sep 17 00:00:00 2001 From: Keane Chan Date: Mon, 24 Oct 2022 23:00:50 +0800 Subject: [PATCH] [resumes][feat] add error message to submit form --- apps/portal/src/pages/resumes/submit.tsx | 66 ++++++++++++++---------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/apps/portal/src/pages/resumes/submit.tsx b/apps/portal/src/pages/resumes/submit.tsx index c851cafa..7901056b 100644 --- a/apps/portal/src/pages/resumes/submit.tsx +++ b/apps/portal/src/pages/resumes/submit.tsx @@ -86,10 +86,16 @@ export default function SubmitResumeForm({ setValue, reset, watch, + clearErrors, formState: { errors, isDirty, dirtyFields }, } = useForm({ defaultValues: { + additionalInfo: '', + experience: '', isChecked: false, + location: '', + role: '', + title: '', ...initFormDetails, }, }); @@ -296,7 +302,7 @@ export default function SubmitResumeForm({ options={ROLES} placeholder=" " required={true} - onChange={(val) => setValue('role', val)} + onChange={(val) => onValueChange('role', val)} /> setValue('location', val)} + onChange={(val) => onValueChange('location', val)} /> {/* Upload resume form */} {isNewForm && ( @@ -335,6 +341,16 @@ export default function SubmitResumeForm({ : 'border-slate-300', 'flex cursor-pointer justify-center rounded-md border-2 border-dashed bg-slate-100 py-4', )}> +
{resumeFile == null ? ( @@ -345,29 +361,15 @@ export default function SubmitResumeForm({ {resumeFile.name}

)} -
- -
+

PDF up to {FILE_SIZE_LIMIT_MB}MB

@@ -394,8 +396,18 @@ export default function SubmitResumeForm({ setValue('isChecked', val)} + onChange={(val) => { + if (val) { + clearErrors('isChecked'); + } + setValue('isChecked', val); + }} /> )}