Data Attributes
The Webflow script uses data-* attributes to configure form behavior without writing any JavaScript.
Form attributes
Section titled “Form attributes”data-ft
Section titled “data-ft”Required. Set on the <form> element to connect it to Formtress.
| Detail | Value |
|---|---|
| Element | <form> |
| Value | Your Form ID from the dashboard |
| Required | Yes |
<form data-ft="your-form-id-here"> <!-- fields --></form>Button attributes
Section titled “Button attributes”data-ft-loading-text
Section titled “data-ft-loading-text”Optional. Set on the text element inside your submit button. When the form is submitting, the text content is replaced with this value. It’s restored when the request completes.
| Detail | Value |
|---|---|
| Element | Text element inside the submit button |
| Value | Loading text string (e.g., "Please wait...", "Sending...") |
| Required | No |
<button type="submit"> <span data-ft-loading-text="Please wait...">Submit</span></button>Error attributes
Section titled “Error attributes”data-ft-error
Section titled “data-ft-error”Optional. Set on an element that should display error messages from the server. When a submission fails, the text content of this element is replaced with the error message.
| Detail | Value |
|---|---|
| Element | Any element (typically a <div> or <p>) |
| Value | (no value needed — presence of the attribute is enough) |
| Required | No |
<div data-ft-error>Something went wrong.</div>The default text (e.g., “Something went wrong.”) is shown initially. When an error occurs, it’s replaced with the server’s error message.
Complete example
Section titled “Complete example”<form data-ft="abc123-your-form-id"> <label for="name">Name</label> <input type="text" id="name" name="name" required />
<label for="email">Email</label> <input type="email" id="email" name="email" required />
<label for="message">Message</label> <textarea id="message" name="message"></textarea>
<!-- Error display --> <div data-ft-error>Something went wrong. Please try again.</div>
<!-- Submit button with loading text --> <button type="submit"> <span data-ft-loading-text="Sending...">Send Message</span> </button></form>