On this page
Show state validation errors
Choose readable messages and place feedback beside the right input.
Before you begin: Check state before submitting.
Choose validation messages
If a field schema has no messages object, or a message for the failed rule is missing, Frontbacked generates one from the field name and rule. firstName becomes first name, user_email becomes user email, and billingAddress.line1 becomes billing address line 1.
Generated examples:
| Failed check | Example message |
|---|---|
required | Please enter your first name. |
min | First name must be at least 2 characters. |
max | First name must be 60 characters or fewer. |
email | Please enter a valid email address. |
sameAs | Confirm password must match password. |
accepted | Please accept terms. |
maxSize | Avatar must be 3 MB or smaller. |
Customize only the messages you care about:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
If feedback.to is not provided, Frontbacked places the message near the first event source for that state. For multiple sources, the first source is used. You can also choose a destination from the schema:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
Use feedback.to to choose where the error goes:
| Value | Result |
|---|---|
"alert" | Built-in high z-index alert with an OK button. |
"toast" | Built-in toast. Use duration to control how long it stays visible. |
"formErrors" or "#formErrors" | Insert the message into that UI element. |
"showFormError" or "showFormError()" | Call a function on window with (message, payload). |
All Frontbacked.state.check() failures are error messages. Use okText to change the alert button text. The built-in alert, toast, and inline messages can be styled with CSS variables such as --fb-feedback-font, --fb-feedback-error-bg, --fb-feedback-error-text, --fb-feedback-button-bg, and --fb-feedback-z-index. See Style FQL’s Built-in UI for the complete feedback variable reference, defaults, and light and dark skin examples.
Continue with Continue an action after sign-in.