Forms
Form <pm-form>
Form helper around a native <form>: validation summary, busy submit button and server errors.
Overview
On submit it validates every field and lists the problems in an error summary that takes focus (each entry jumps to its field). It keeps the submit button busy while the request runs, and shows errors returned by the server on the right fields.
Listen for pm-submit; call event.detail.waitUntil(promise) for async work. A form without an action never reloads the page.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
no-summaryprop: noSummary | boolean | — | Do not show the error summary; focus the first invalid field instead. |
summary-titleprop: summaryTitle | string | — | Heading of the error summary (default "Please fix 2 fields", with the number of fields that have a problem). |
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-invalid | onPmInvalid | Submit was blocked. detail.fields lists the fields with a problem. |
pm-submit | onPmSubmit | The form is valid and was submitted. |
Slots
| Slot | Description |
|---|---|
(default) | One <form> with Prismora or native controls. |
Methods
validate(), setErrors()