Extension fields for bindings
Add a submission handler
Handlers are called in this order:
willSubmit - Called before submission starts, to veto or prepare it (serialized; false stops the submission)submit - Async handlers that perform the submission and return whether it succeeded (serialized)didSubmit - Called once with the outcome after submission completes,
except for a submission cancelled by a newer oneCreate UI binding for form elements
Action.boundconfigureConfigure the form locally
Override the global configuration locally
Reset to the global configuration
ReadonlyidIdentity of the form instance
Unique per instance and fixed for its lifetime, but not reproducible: a server render and the client render that hydrates it produce different values. For an id that reaches the DOM, use stableId instead.
Id of the form for the DOM, which the FormField.stableId of its fields build on
Starts as id: unique on the page, but different between a server render and the
client render that hydrates it. For a server-rendered form, assign an id that both arrive at.
It is used as is, so nothing else on the page may use it. useId(), by way of useFormSSR
from @mobx-sentinel/react, is both; a key from your own data works as long as it is unique
on the page.
Not reactive: bindings read it as they are called, so assign it before binding, and on every render if it can change. Assigning id back leaves the fields on their own ids again.
Applies to this form alone. A sub-form is a separate instance with its own.
ReadonlyvalidatorReadonlywatcherComputedcanComputedconfigThe configuration of the form
This is a computed value that combines the global configuration and the local configuration.
ComputedfirstComputedisWhether the form is busy (submitting or validating)
Whether the form is in submitting state
Sub-forms within the form.
Forms are collected via @nested annotation.
StaticdisposeStaticgetStaticgetActionreportReport error states on all fields and sub-forms
ActionresetSubmit the form.
Optionalargs: { force?: boolean }
Optionalforce?: booleanWhether to force submission even if canSubmit is false.
It cancels the submission in progress, if any.
The cancelled submission resolves false without calling didSubmit handlers.
true if submission succeeded, false if failed or cancelled
true, and returns false without running any handler if notwillSubmit or submit handler returns false
Form manages submission, fields, and bindings.
Key features: