DEV Community

Cover image for jamstack static website forms
irishgeoff9
irishgeoff9

Posted on

jamstack static website forms

jamstack forms

I am going to show you a quick solution on how to quickly add static website forms to any static website.

As you may know, a static website does not have a backend -- so there are no server-side languages to handle any forms.

A static site only consists of just (HTML,CSS and Javascript). Static website are also known as jamstack websites.

That begs the question. How can you add a static website form to your website?

static website forms

Turns out, its quite simple. We will be using a forms back-end service called fabform.io to add a contact form to our static site.

Simply navigate to fabform.io to create a free account and click on "Create Endpoint". Cut and paste your new endpoint id into the action property of your HTML contact form.

Here is an example HTML contact form for your jamstack ~ static website.

<form action="https://fabform.io/f/{form-id}" method="post">
 <label for="email">Your Email</label>
 <input name="email" type="email">
 <button type="submit">Submit</button> 
</form>
Enter fullscreen mode Exit fullscreen mode

Feel free to modify your contact form and add any fields you which to collect forms data from.

Just remember to name each html forms field with the name you want to store each field for.

That's all there is to it. You can now publish your jamstack ~ static website as you normally do.

Congratulations! You have a fully working a static website form on up and running on your site.

Bonus

If you are creating a new website with the hugo static website generator.

I would recommend you check out these awesome free hugo themes that have static website forms already built into the themes.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️