Connect Formli to the existing Webflow form
How it works
There are two ways to use Formli HTML forms with Webflow sites. The first way is to copy the code that is ready to be embedded and paste it into a Webflow page, and then customize it. Alternatively, you can manually connect form elements of an already created Webflow form using custom attributes.
Setup Guide
Assuming you have already created and styled a Webflow form on your website, you can now proceed to connect this form element by element. Here, we will provide an example of connecting a simple subscription form with Name and Email data fields.
- Create a corresponding Formli
- Connect form container
- Connect data fields
- Connect success and error messages
- Publish the changes
Step 1. Create a corresponding Formli
- Create a Formli data fields block with the same fields as the Webflow form. How to create and customize data fields, please check this guide. The prompt and styling of the Formli block are not important. Make sure that the types of the data fields in Formli correspond to those in Webflow to avoid any potential errors.
- Open the
… More
menu and click on theEmbed on website
option. - Select
HTML
in the dropdown list. - Click the
Copy Code
button. - Insert the code before
</head>
tag in the Webflow page settings. - Save the settings.
Step 2. Connect form container
- Select form in the Navigator
- Open form settings
- Add
Action
link (copy it from HTML Form Code) and changeMethod
to POST. - Find
<form>
tag in the HTML Form Code. Copydata-os-uuid
anddata-os-element
with their values and add them as custom attributes to the Webflow form. It will connect Webflow form with the exact Formli block.
Step 3. Connect data fields
- Select form data field
- Open field settings.
- Find
<input>
tag in the HTML Form Code for the correspondiing data field. Copydata-os-uuid
anddata-os-element
with their values and add them as custom attributes to the Webflow data field. It will connect Webflow data field with the Formli data field. - To display errors specific to each field:
- Add a
<div>
container in the form (e.g. under the field). - Copy
data-os-uuid
anddata-os-element
with their values and add them as custom attributes to the<div>
container. - Add
class = 'os-hidden'
to the<div>
container. - Repeat the same for all fields in the form.
Step 4. Connect success and error messages
- Select Success message for the form in the Navigator
- Open Settings.
- Find
<div>
tag for the success message in the HTML Form Code and add the attributedata-os-element="form-success"
. This will cause the tagged element to be shown when the form successfully saves. - Add
class = 'os-hidden'
to the success message. - Find
<div>
tag for the success message in the HTML Form Code and add the tagdata-os-element="form-success"
. This will cause the tagged element to be shown when the form successfully saves.
Step 5. Publish the changes
Your website form is now successfully connected to Formli. Publish your changes and test if it works as expected!