diff --git a/comps/form/Field.tsx b/comps/form/Field.tsx index 5dae4f1..cc2944b 100755 --- a/comps/form/Field.tsx +++ b/comps/form/Field.tsx @@ -169,7 +169,6 @@ export const Field: FC<{ onChangeCapture={ typeof on_change === "function" ? (e) => { - console.log(e.currentTarget.value); on_change({ value: e.currentTarget.value }); } : undefined diff --git a/comps/form/Form.tsx b/comps/form/Form.tsx index e633777..fee5381 100755 --- a/comps/form/Form.tsx +++ b/comps/form/Form.tsx @@ -17,6 +17,7 @@ export const Form: FC<{ const local = useLocal({ el: null as any, + submit_timeout: null as any, layout: "unknown" as "unknown" | "2-col" | "1-col", }); @@ -34,7 +35,11 @@ export const Form: FC<{ onSubmit={(e) => { e.preventDefault(); e.stopPropagation(); - on_submit({ form: form.hook.getValues(), error: {} }); + + clearTimeout(local.submit_timeout); + local.submit_timeout = setTimeout(() => { + on_submit({ form: form.hook.getValues(), error: {} }); + }, 300); }} >