Skip to main content

A form that submits to an Extbase action with fetch and shows validation errors on its fields.

Use `https://down.example.com` to preview the generic error state.

The Forms guide walks through a form from the template to the controller.

Read more about installing Components and Primitives.

Options that take a function go to Form in your entry file, because a function cannot travel through the server-rendered markup. Mount the form from your entry file as shown in Send the values.

values uses your field names as dot paths such as person.name and keeps leaf values as string | File. Validation and server errors are keyed by field name too, so a nested field reports under person.name.

Set validationMode on the form to give all its fields the same timing, and inputDebounceMs to change how long they wait for a pause in typing before they validate: 100 by default, at least 50. A field that sets its own validationMode keeps it. The modes are described under Validation mode of the field.

The following tables cover the available props of the Fluid Primitives.

Submits and manages the form state. Renders a <form> element.

NameDescriptionRequiredDefault
actionUristring
The resolved form action URI to submit to directly.
No
-
actionstring
The Extbase action name used to build the form action URI.
No
-
extensionNamestring
The Extbase extension name used to build the form action URI.
No
-
pluginNamestring
The Extbase plugin name used to build the form action URI.
No
-
controllerstring
The Extbase controller name used to build the form action URI.
No
-
argumentsarray
The Extbase arguments used to build the form action URI.
No
-
pageUidint
The target page UID used to build the form action URI.
No
-
objectNamestring
The object name prefix used for nested form field names.
No
-
validationModeEnum\ValidationMode
When the fields of the form validate, unless a field sets its own `validationMode`. `auto` validates on blur once the value was edited and on every change while an error shows, `onBlur` only on blur, `onChange` on every change, `onSubmit` only on submit. A submit validates every field in every mode.
No
Auto
inputDebounceMsinteger
How long the fields wait after the last change before they read their value, 100 by default and at least 50. A `validate` that sends a request should not fire on every keystroke.
No
-
objectmixed
The bound object used for form value mapping.
No
-
methodstring
The HTTP method used for form submission.
No
'post'
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
rootIdstring
The root ID of the component, used for hydration and identification.
No
-
idsarray
The IDs of of the component parts for composition.
No
[]
autoMountboolean
Whether the client initializes the component on its own. Set it to false to mount it yourself with `mount()`
No
true
providerstring
The `id` of the `.provider` this root takes its `rootId` and props from.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-stateThe state of the form. One of: "invalid", "ready", "submitting", "success", "error".
data-submittingPresent while the form is being submitted.
data-invalidPresent when invalid
data-dirtyPresent when dirty
data-touchedPresent when touched

Wraps the editable form UI. It stays visible in ready, invalid, and submitting, and hides in error and success. Renders a <div> element.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Displays content for an exact form state such as error, success, or submitting. Renders a <div> element.

NameDescriptionRequiredDefault
stateEnum\FormState
The form state to render.
Yes
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Displays the current form-level error text set through the Form API, or its slotted fallback text. Renders a <span> element.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Displays the current form-level success text set through the Form API, or its slotted fallback text. Renders a <span> element.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
NameDescriptionDefault
idstring
The unique identifier of the form.
-
validationFormValidation | undefined
Validates the values of the form on the client: a Standard Schema validator such as Zod, or a synchronous callback that gets the values and returns the errors by field name. It cannot be set from a Fluid template, only by constructing Form in your own entry file.
-
objectNamestring | undefined
The object name that prefixes the names of nested form fields.
-
fieldNamePrefixstring | undefined
The Extbase argument namespace (tx_events_list) post() prefixes the field names with. Set by the server from the plugin the form submits to.
-
inputDebounceMsnumber | undefined
How long the fields wait after the last change before they read their value, never less than 50. A validate that sends a request should not fire on every keystroke.
100
validationModeValidationMode | undefined
When the fields of the form validate, unless a field sets its own validationMode.
"auto"
onSubmit(({ values, api, event }: { values: FormValues; api: FormApi; event: JSX.FormEvent<HTMLElement>; }) => Promise<FormSubmitResult> | FormSubmitResult) | undefined
Called with the values once the form is valid and submitted. Return true for success, false for an error, or field errors to mark the form invalid. Send the values with extbase.post(api.getAction(), values.toObject(), { prefix: api.getFieldNamePrefix(), objectName: api.getObjectName() }): a 422 JSON response of JsonValidationErrorsTrait it throws is mapped to field errors, or to the error text of the form for the errors of the object itself.
-
render((form: Form) => void) | undefined
Called every time the form state changes. Use it to update UI the form does not wire itself.
-
NameTypeDescription
isSubmittingbooleanWhether the form is being submitted.
isDirtybooleanWhether the value of any field differs from the one it started with.
isInvalidbooleanWhether any field is invalid.
isSuccessfulbooleanWhether the last submit succeeded.
isErrorbooleanWhether the last submit ended in an error.
getValues() => FormValuesThe current values of the form.
getErrors() => FormErrorsThe errors of the invalid fields, by field name.
getDirty() => FormDirtyThe dirty fields, by field name.
getTouched() => FormTouchedThe touched fields, by field name.
getErrorText() => string | nullThe text of the error status of the form, null if there is none.
setErrorText(text: string | null) => voidSets the text of the error status. Pass null to remove it.
getSuccessText() => string | nullThe text of the success status of the form, null if there is none.
setSuccessText(text: string | null) => voidSets the text of the success status. Pass null to remove it.
clearStatusText() => voidRemoves the error and the success text.
getAllFields() => Map<string, FieldHandle>Every field of the form, by name.
getField(name: string) => FieldHandle | undefinedThe field with this name, undefined if the form has none.
getFormEl() => HTMLFormElement | nullThe <form> element.
getAction() => stringThe action of the form, an empty string if it has none.
getFieldNamePrefix() => string | undefinedThe Extbase argument namespace (tx_events_list) of the action the form submits to.
getObjectName() => string | undefinedThe objectName of the form: the name of the object its fields belong to.
reset() => voidResets the form to its initial state.
syncFields() => voidPicks up fields that were added or removed after the form was hydrated.
renameField(oldName: string, newName: string) => voidRenames a field, keeping its value, touched, dirty and error state. Useful to keep the rows of a FieldArray contiguously indexed after one in the middle was removed.