This guide will demonstrate the quick process of adding a contact form to your Gatsby project and connecting it to Formzillion for submission handling.
How to create a Gatsby Contact Form
Sign in to your Formzillion account and create a new form with name Gatsby Contact Form or a similar identifier. Formzillion will assign a unique form ID specifically for identifying your Gatsby form.
It is a basic contact form with name, email address and message fields:
The Gatsby command line interface (CLI) is the main tool you use to initialize, build and develop Gatsby sites. Know more
Open your terminal and enter the following command to initiate the creation of your Gatsby site.
Create a new site.
Navigate to the site folder by changing directories, and execute the following command:
You can now access the site in your browser by visiting https://localhost:8000. Below observe the sample site displayed on the screen:
To incorporate a contact form into your Gatsby site, you can either add it to the existing src/pages/index.js file or create a new file called contact.js within the src/pages directory. Then, simply insert the given code block into the chosen file
To successfully submit your form to Formzillion, ensure that you include the 'FORM_ID' in the provided form code. This 'FORM_ID' should correspond to the ID assigned to your specific Formzillion form.
And there you have it! Once you fill out and submit the form, you will be able to view the default submission thank you page.
Congratulations! Your Gatsby site now has the contact form powered by Formzillion!