From ea13342bcb746cc9a8ff61df5f976d99f7b095b7 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 15 Feb 2026 22:10:29 -0600 Subject: [PATCH] disable save when form is invalid --- web/src/components/config-form/ConfigForm.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/components/config-form/ConfigForm.tsx b/web/src/components/config-form/ConfigForm.tsx index 36e430da2..7c24c6935 100644 --- a/web/src/components/config-form/ConfigForm.tsx +++ b/web/src/components/config-form/ConfigForm.tsx @@ -216,6 +216,8 @@ export interface ConfigFormProps { formData: unknown, errors: FormValidation, ) => FormValidation; + /** Called whenever form validation state changes */ + onValidationChange?: (hasErrors: boolean) => void; } export function ConfigForm({ @@ -237,6 +239,7 @@ export function ConfigForm({ formContext, i18nNamespace, customValidate, + onValidationChange, }: ConfigFormProps) { const { t, i18n } = useTranslation([ i18nNamespace || "common", @@ -319,9 +322,10 @@ export function ConfigForm({ const handleChange = useCallback( (e: IChangeEvent) => { + onValidationChange?.(Array.isArray(e.errors) && e.errors.length > 0); onChange?.(e.formData); }, - [onChange], + [onChange, onValidationChange], ); const handleSubmit = useCallback(