frameSubmit
Submits a form into the frame that renders it.
import { frameSubmit } from "@sdxc/ui/mixins";Usage
Sends the form's submission through its enclosing frame, marking the form aria-busy until
the answer renders there; the frame then returns to its own address, so the action answers a
frame request with the frame's content, a redirect to it included. A newer submission wins.
Signature
frameSubmit(options?: FrameSubmit.Options): MixinDescriptor<HTMLFormElement>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options | FrameSubmit.Options | No |
Examples
<form method="post" action="/actions/rename" mix={[frameSubmit()]}>…</form>form.addEventListener("ui:frame-submit", (event) => event.state === "failed" && retry());Used with it
The events, constants and types its module publishes, each imported from @sdxc/ui/mixins too.
FrameSubmitEvent
Dispatched on a frameSubmit form as a submission moves through its states. Each
submission reports pending and then exactly one of the other states.
new FrameSubmitEvent(init: { state: FrameSubmit.State; action: string; error?: unknown })| Property | Type | Required | Description |
|---|---|---|---|
state | readonly FrameSubmit.State | Yes | Where the submission stands; pending always comes first. |
action | readonly string | Yes | The address the form submitted to. |
error | readonly unknown | Yes | Why the frame could not load the answer, set only on failed. |
FrameSubmit.Options
Configuration for frameSubmit.
| Member | Type | Required | Description |
|---|---|---|---|
keepSrc | boolean | No | Keeps the frame's own address for later reloads. Set false to have the frame adopt the form's action as its address once the submission settles. |
FrameSubmit.State
Where a submission stands: pending once it is sent, settled once the frame shows the
answer, aborted when a newer reload of the frame replaced it, and failed when the
frame could not load the answer.
type FrameSubmit.State = "pending" | "settled" | "aborted" | "failed"