From 68792308e89d45b42acc5632e79fbbf1eb2dc3bb Mon Sep 17 00:00:00 2001 From: Mike <100624415+marqueone-ps@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:30:34 -0700 Subject: [PATCH] feat: CE-1067 NRIS number data validation (#658) Co-authored-by: Mike Sears --- .../outcomes/ceeb/ceeb-decision/decision-form.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx b/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx index 1c70d2102..54016eaa8 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx @@ -109,6 +109,7 @@ export const DecisionForm: FC = ({ if (officerAssigned) { applyData({ ...data, assignedTo: officerAssigned }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [officerAssigned]); //-- update the decision state by property @@ -327,8 +328,12 @@ export const DecisionForm: FC = ({ _isValid = false; } - if (data.actionTaken === CASE_ACTION_CODE.RESPREC && !data.inspectionNumber) { - setInspectionNumberErrorMessage("Required"); + if ( + data.actionTaken === CASE_ACTION_CODE.RESPREC && + data.inspectionNumber && + !data.inspectionNumber.match(/^\d{1,10}$/) + ) { + setInspectionNumberErrorMessage("Invalid format. Please only include numbers."); _isValid = false; } @@ -464,7 +469,7 @@ export const DecisionForm: FC = ({ inputClass="comp-form-control" value={data?.inspectionNumber} error={inspectionNumberErrorMessage} - maxLength={5} + maxLength={10} onChange={(evt: any) => { const { target: { value },