Written by: Geoffrey Callaghan

create contact form with gitbook

Create Contact Form With Gitbook

To create a contact form with GitBook using FabForm, you need to follow a few steps. Here’s a step-by-step guide:

  1. Set Up Your GitBook Project:

    • If you haven’t already, create a GitBook project. You can do this by signing up on GitBook and creating a new project.
  2. Prepare Your Markdown File:

    • In your GitBook project, you’ll use Markdown files to create content. Open or create the Markdown file where you want the contact form to appear.
  3. Integrate FabForm:

    • FabForm is a service that allows you to create forms and handle form submissions easily. First, sign up for FabForm at FabForm.io and create a new form. Configure the form fields according to your requirements.
  4. Embed FabForm in GitBook:

    • FabForm provides an HTML code snippet that you can embed in your webpage. GitBook supports HTML in Markdown, so you can embed the form directly in your Markdown file.

Here’s an example of how to do it:

Step-by-Step Example

  1. Create and Configure a Form in FabForm:

    • Log in to FabForm and create a new form. Add the fields you need (e.g., Name, Email, Message).
    • Once the form is created, get the HTML embed code provided by FabForm.
  2. Embed the Form in GitBook:

    • Open the Markdown file in your GitBook project where you want to add the contact form.
    • Embed the form using the HTML code snippet from FabForm.

Here is an example of what the Markdown file might look like:

# Contact Us

We would love to hear from you! Please fill out the form below to get in touch.

<!-- FabForm Embed Code Start -->
<form action="https://fabform.io/f/your-form-id" method="post">
  <label for="name">Name:</label><br>
  <input type="text" id="name" name="name" required><br><br>
  
  <label for="email">Email:</label><br>
  <input type="email" id="email" name="email" required><br><br>
  
  <label for="message">Message:</label><br>
  <textarea id="message" name="message" rows="4" required></textarea><br><br>
  
  <input type="submit" value="Submit">
</form>
<!-- FabForm Embed Code End -->

Explanation

  • The action attribute in the <form> tag should point to the URL provided by FabForm for your specific form.
  • The name attributes of the <input> and <textarea> tags should match the field names configured in FabForm.
  • The required attribute ensures that users cannot submit the form without filling out these fields.
  1. Deploy Your GitBook Project:
    • Once you’ve added the form to your Markdown file, save the changes and deploy your GitBook project. GitBook will render the HTML form correctly on the webpage.

Summary

By following these steps, you can integrate a FabForm contact form into your GitBook documentation. This allows visitors to submit inquiries directly through your documentation site, and you can handle the submissions using FabForm’s backend services.