DocsAccounts & records · FQL
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 checkExample message
requiredPlease enter your first name.
minFirst name must be at least 2 characters.
maxFirst name must be 60 characters or fewer.
emailPlease enter a valid email address.
sameAsConfirm password must match password.
acceptedPlease accept terms.
maxSizeAvatar must be 3 MB or smaller.

Customize only the messages you care about:

js

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:

js

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:

ValueResult
"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.