← Back to Catalog

Form in modal lifecycle

form-in-modal-lifecycle

Form-in-Modal lifecycle — list-page "create" may popup a form in Modal. `destroyOnHidden` does not clear Form fields — call `resetFields`. `useForm` before open is disconnected unless `forceRender` (or equivalent). Prefer native submit; if the submit control is outside the Form (Modal footer), call `form.submit`.

Description

List-page create may open a form in a Modal. destroyOnHidden does not clear Form fields—call resetFields. useForm created before open stays disconnected unless forceRender (or equivalent) connects it. Prefer native submit; if the submit control sits in the Modal footer outside the Form, call form.submit. Stale fields, disconnected instances, or footer buttons that never submit break the lifecycle.

When to use

List-page create flows that open a form inside a modal.

Not when

Inline page forms that are not mounted in a create Modal lifecycle.

Agent hint

Call resetFields on reopen; connect useForm; submit via form.submit from footer.

Pass

Reopened create-modal form is reset (`resetFields`); form instance is connected when opened; footer submit still submits the Form (`form.submit` if outside).

Fail

Stale fields after close (`destroyOnHidden` treated as reset); disconnected `useForm` without force-render; footer button that does not submit the Form.

Citations

Ant Design — Form ; Ant Design — Modal

https://ant.design/components/form

Open UX · cited UX rules agents audit against

Privacy · Sources ·