Skip to content

Commit

Permalink
feat: CE-1067 NRIS number data validation (#658)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Sears <[email protected]>
  • Loading branch information
marqueone-ps and Mike Sears authored Sep 25, 2024
1 parent c56d2ff commit 6879230
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const DecisionForm: FC<props> = ({
if (officerAssigned) {
applyData({ ...data, assignedTo: officerAssigned });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [officerAssigned]);

//-- update the decision state by property
Expand Down Expand Up @@ -327,8 +328,12 @@ export const DecisionForm: FC<props> = ({
_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;
}

Expand Down Expand Up @@ -464,7 +469,7 @@ export const DecisionForm: FC<props> = ({
inputClass="comp-form-control"
value={data?.inspectionNumber}
error={inspectionNumberErrorMessage}
maxLength={5}
maxLength={10}
onChange={(evt: any) => {
const {
target: { value },
Expand Down

0 comments on commit 6879230

Please sign in to comment.