Skip to content

Commit

Permalink
Merged in r2-2990-required-txt-field (pull request #6903)
Browse files Browse the repository at this point in the history
R2-2990: Fixing required fields on subforms are not highlighted
  • Loading branch information
jtoliver-quoin committed Aug 16, 2024
2 parents 831e9c8 + a4dcbce commit 1ba0dcf
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (c) 2014 - 2023 UNICEF. All rights reserved.

/* eslint-disable camelcase */

import { useEffect } from "react";
import PropTypes from "prop-types";
import { subYears } from "date-fns";
import { TextField as MuiTextField } from "formik-mui";
import { useDispatch } from "react-redux";
import { ButtonBase } from "@mui/material";
import { FastField, connect } from "formik";
import { FastField, connect, getIn } from "formik";
import { useParams } from "react-router-dom";
import omitBy from "lodash/omitBy";
import isEmpty from "lodash/isEmpty";
Expand All @@ -29,6 +28,7 @@ function TextField({ name, field, formik, mode, recordType, recordID, formSectio
const i18n = useI18n();
const dispatch = useDispatch();
const { id } = useParams();
const errors = getIn(formik.errors, name);

const recordName = useMemoizedSelector(state => selectRecordAttribute(state, recordType, recordID, "name"));

Expand Down Expand Up @@ -81,6 +81,7 @@ function TextField({ name, field, formik, mode, recordType, recordID, formSectio
data-testid="text-field"
variant="outlined"
form={renderProps.form}
error={errors}
field={{
...renderProps.field,
InputProps: { ...fieldProps.InputProps, ...(rest.error ? { error: rest.error } : {}) },
Expand Down

0 comments on commit 1ba0dcf

Please sign in to comment.