DEV Community

Geoff
Geoff

Posted on

Static website forms

Tutorial: Creating Forms for a Static Website Using Fabform.io

If you have a static website (e.g., built with HTML, CSS, JavaScript), you might need to capture user data via forms, such as contact forms or surveys. Since static websites don't have a backend, processing form data can be tricky. Fabform.io provides an easy way to handle form submissions by collecting and forwarding form data without needing a server.

Here's a step-by-step guide on how to set up a form for your static site using Fabform.io.


Step 1: Sign Up for Fabform.io

  1. Visit Fabform.io: Go to Fabform.io and sign up for a free account. You can use your email or social logins.
  2. Verify Your Account: Confirm your email to access the platform and start building forms.

Step 2: Create a Form in Fabform.io

  1. Create a New Form:

    • Once logged in, click on "Create New Form".
    • Give your form a name (e.g., "Contact Form").
    • You can specify the fields that you want, or just create the form to receive all fields from your static form.
  2. Customize Form Settings:

    • Redirect URL: You can specify where the user is redirected after submission (e.g., a thank-you page on your website).
    • Notification Settings: Choose how you want to be notified when someone submits the form. You can add an email address to receive submission notifications.
    • Spam Protection: Enable spam protection options like reCAPTCHA.
  3. Save the form to generate the Form Action URL.


Step 3: Integrate Fabform.io into Your Static Website

Now that your form is created on Fabform.io, you’ll integrate it into your HTML form.

  1. Create Your HTML Form:
    • Add the form structure in your static website as usual. Here's a basic contact form example:
   <form action="https://fabform.io/your-form-id" method="POST">
       <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" required></textarea>

       <button type="submit">Submit</button>
   </form>
Enter fullscreen mode Exit fullscreen mode
  • Replace "https://fabform.io/your-form-id" with the Form Action URL you generated in Step 2.
  1. Add Additional Fields: You can add any input fields you need (e.g., phone number, dropdown menus) according to your form's requirements.

Step 4: Test the Form Submission

  1. Deploy Your Static Website: Ensure your website is live, whether it's on GitHub Pages, Netlify, Vercel, or any other static hosting service.
  2. Submit the Form: Go to the page where your form is embedded and try submitting it. You should be redirected to the success URL you specified.
  3. Check Notifications: Confirm you received a notification with the form data.

Step 5: View Form Submissions

  1. Check Submission Data: Log into your Fabform.io account and go to the Submissions section.
  2. Export Data: You can export your form data in CSV format for further analysis.

Conclusion

Using Fabform.io, you can easily integrate forms into your static websites without worrying about backend code or infrastructure. Fabform.io handles form submissions securely and efficiently, allowing you to focus on other aspects of your website.

Top comments (0)