DEV Community

Mohammed Subhan Khan
Mohammed Subhan Khan

Posted on • Originally published at on


Using forms in Netlify

The features that Netlify provides always surprise me. A cool feature Netlify provides is support for custom forms. You just include Netlify provided form markup in your page and you are done. Whenever someone on your website submits information using this form, Netlify will automatically provide the information they submitted on the Netlify dashboard. What’s more Netlify also provides some advanced form features like reCAPTCHA, file upload, exporting form notifications to csv, integration with Slack and Zapier etc.

I have used this feature to create a contact form for my contact page. Here is the recipe to do this.

Include form markup in your page.

Include the Netlify provided form markup in your desired page. I have used this code

<form name="contact" method="POST" data-netlify="true">
    <label style="font-family: monospace;">Name<br><input style="width: 100%;" type="text" name="name" /></label>   
    <label style="font-family: monospace;">Email<br><input style="width: 100%;" type="email" name="email" /></label>
    <label style="font-family: monospace;">Message<br><textarea style="width: 100%;" rows="15" name="message"></textarea></label>
  <div data-netlify-recaptcha="true"></div>
    <button class="send-button" type="submit">Send</button>

Note the use of data-netlify=”true” in the form tag. This tells Netlify to show form submissions on the Netlify dashboard. Also all the fields should be provided with the name attribute.

Finally I am including reCAPTCHA support for spam protection using <div data-netlify-recaptcha="true"></div>.

Connect to Zapier

Whenever a user submits a form, you may want to be notified using email. Netlify provides an integration with Zapier for this purpose. You will need to configure this integration to use the desired ‘to’ address. You can also configure this integration in such a way that it will use the form name, email and message that the user has submitted.


You can also use AJAX form submissions. Netlify also allows the form to be used in libraries like React and Vue

The documentation for Netlify Forms can be found here.

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git