diff --git a/webapp/packages/core-blocks/src/FormControls/FormContext.ts b/webapp/packages/core-blocks/src/FormControls/FormContext.ts index 98042f8c0e..306a25f08b 100644 --- a/webapp/packages/core-blocks/src/FormControls/FormContext.ts +++ b/webapp/packages/core-blocks/src/FormControls/FormContext.ts @@ -21,7 +21,7 @@ export interface IChangeData { export interface IFormContext { ref: HTMLFormElement | null; onValidate: SyncExecutor; - onSubmit: SyncExecutor; + onSubmit: SyncExecutor; onChange: IExecutor; parent: IFormContext | null; disableEnterSubmit: boolean; diff --git a/webapp/packages/core-blocks/src/FormControls/useForm.ts b/webapp/packages/core-blocks/src/FormControls/useForm.ts index 711aa0c0c4..33f05adbb5 100644 --- a/webapp/packages/core-blocks/src/FormControls/useForm.ts +++ b/webapp/packages/core-blocks/src/FormControls/useForm.ts @@ -22,7 +22,7 @@ interface IOptions { export function useForm(options?: IOptions): IFormContext { let parentForm = useContext(FormContext); - const [submittingExecutor] = useState(() => new SyncExecutor()); + const [submittingExecutor] = useState(() => new SyncExecutor()); const [validationExecutor] = useState(() => new SyncExecutor()); const [changeExecutor] = useState(() => new Executor()); @@ -49,7 +49,7 @@ export function useForm(options?: IOptions): IFormContext { useExecutor({ executor: submittingExecutor, - handlers: [() => options?.onSubmit?.()], + handlers: [event => options?.onSubmit?.(event)], }); const context = useObjectRef( @@ -93,7 +93,7 @@ export function useForm(options?: IOptions): IFormContext { event?.preventDefault(); if (this.validate()) { - this.onSubmit.execute(); + this.onSubmit.execute(event); } } },