SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

frameSubmit

Submits a form into the frame that renders it.

tsx
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

typescript
frameSubmit(options?: FrameSubmit.Options): MixinDescriptor<HTMLFormElement>

Parameters

ParameterTypeRequiredDescription
optionsFrameSubmit.OptionsNo

Examples

tsx
<form method="post" action="/actions/rename" mix={[frameSubmit()]}>…</form>
tsx
form.addEventListener("ui:frame-submit", (event) => event.state === "failed" && retry());

The events, constants and types its module publishes, each imported from @sdxc/ui/mixins too.

Event

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.

typescript
new FrameSubmitEvent(init: { state: FrameSubmit.State; action: string; error?: unknown })
PropertyTypeRequiredDescription
statereadonly FrameSubmit.StateYesWhere the submission stands; pending always comes first.
actionreadonly stringYesThe address the form submitted to.
errorreadonly unknownYesWhy the frame could not load the answer, set only on failed.
Interface

FrameSubmit.Options

Configuration for frameSubmit.

MemberTypeRequiredDescription
keepSrcbooleanNoKeeps 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.
Type

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.

typescript
type FrameSubmit.State = "pending" | "settled" | "aborted" | "failed"
@sdxc/ui

Can’t find it? Contact us