From 3f2ed743ebf2c657bcf39d585358c60c8884644f Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 4 Nov 2025 08:15:28 -0600 Subject: [PATCH] ensure id field is expanded on form errors --- web/src/components/input/NameAndIdFields.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/src/components/input/NameAndIdFields.tsx b/web/src/components/input/NameAndIdFields.tsx index ad4ebcfcc..f4d004cc4 100644 --- a/web/src/components/input/NameAndIdFields.tsx +++ b/web/src/components/input/NameAndIdFields.tsx @@ -41,7 +41,12 @@ export default function NameAndIdFields({ placeholderId, }: NameAndIdFieldsProps) { const { t } = useTranslation(["common"]); - const { watch, setValue, trigger } = useFormContext(); + const { + watch, + setValue, + trigger, + formState: { errors }, + } = useFormContext(); const [isIdVisible, setIsIdVisible] = useState(false); const defaultProcessId = (name: string) => { @@ -66,6 +71,13 @@ export default function NameAndIdFields({ return () => subscription.unsubscribe(); }, [watch, setValue, trigger, nameField, idField, effectiveProcessId]); + const idError = errors[idField]; + useEffect(() => { + if (idError) { + setIsIdVisible(true); + } + }, [idError]); + return ( <>