Building forms in Builder.io
Easily create or embed forms in any Builder content with these tips!
Were going to go over two ways of making a form in Builder. The easiest way to make a form is by using other services like Google forms, Type form, etc. and embedding the form into your Builder page. The more advanced way is creating a custom form completely inside of Builder and connecting it to your backend. Below we will go over:
Embedding a form using URL
To export your Google form, click “Send”. It gives you three different options on how to share this form, we are going to use the URL. Copy the form's URL. Navigate back to Builder and drag and drop the embedded code component onto your page. Click “edit”, and paste the URL.
Embedding a form using custom code
If embedding your form using the URL does not work, you can use custom code. In Google forms, there is an embedded code option. Copy this code, navigate back to Builder, and drop in the custom code component. Click edit, and paste the code into the editor.
👉Developer permissions are required to use the custom code field
Creating a form in Builder
To make a custom form in Builder, you will either need to be a developer or have one handy because this form will need to be wired up to your backend. To begin, drag and drop the form component into your page. Now, you can customize and style the form however you want.
If you decided to add more inputs, make sure you are giving them each the correct name. This is how the information entered gets sent back and how it knows what each value entered is assigned to.
Connecting your backend
There is also a more advanced option to fully customize how your form sends. If you navigate to the actions section in the "Data" tab, you can create a new action with the type "submit". Then, you can handle the form submission manually. If you want to create intricate forms (e.g. size availability, color selection for a specific product), this is where you can do so. If this is something you'd like to do, we'd recommend watching some of our tutorials such as using your custom react components, connecting your api data to Builder, and State and actions. Once you have your form finished, you can save it as a template and use it on any page. The form will already have the functionality and styling applied, so you don't have to redo any code.