On this page
Build your first form
Connect a sign-up form to state, validation and submission.
Before you begin: Make your page reactive.
Minimal Form
FQL selectors are normal CSS selectors. You can use ids, descendants, attributes, and spaces in the selector before the event segment.
In this form, FQL keeps state in sync, prevents the default form reload for the onsubmit binding, Frontbacked.state.check() shows validation messages, and frontbacked.js locks the submit button while Frontbacked.signUp() is waiting for a response. The button gets frontbacked-loading, its text changes through f-loading-text, and repeated submits from the same button are ignored until the request finishes.
The messages object is optional and can define messages for specific failed checks. In the example, email.required and password.min use custom copy. Other failures are still handled: an invalid email gets a generated message such as Please enter a valid email address., an empty password gets Please enter your password., and unchecked terms gets Please accept terms. Frontbacked builds those fallback messages by turning field keys such as firstName or first_name into readable names.
Continue with Initialize frontbacked.js.