How To Use Netlify For Your Forms

Sep 25, 2018 · 205 words · 1 minute read netlify forms

Netlify is becoming the place to host all of your static projects. Netlify allows for continuous deployment so that whenever you make a commit from your git repos it will run a command and then server whatever folder that you specified in the settings.

They recently had expanded to some new areas Functions / Forms and Identity. Today, we are going to look at the form service and show how we can easily get a web form that netlify will handle all of the process for.

<form name="contact" method="POST" netlify>

The first step is simple to just add the netlify attribute to your form element. Whatever you put inside of name=“contact” Netlify will reference that in your dashboard as well. That is pretty much it to start receiving data.

Spam Filtering

Netlify also has a built in “honeypot” field that you can tap into.

<form name="contact" method="POST" netlify-honeypot="bot-field" netlify>

If we add those attributes to the form element that we need then need to reference the hidden field inside the form element.

<p class="hidden">
	<label>Don’t fill this out if you're human: <input name="bot-field" /></label>
  </p>

Netlify has more options as well as setting up a recaptcha if you need to go to that level. https://www.netlify.com/docs/form-handling/