Adding (data-netlify="true") to Form Code


How does the netlify form code know to route the forms from my website will be sent to your databases if I am on the forms level 0 plan. I have my notifications on. I tried inserting that line of code into my form, but all I got was blank data. I am trying to use the netlify-forms code in my website by inserting the following code into my html file.

form name="contact" method="POST" data-netlify="true"

Is there another particular setting in the code or is the info auto routed somehow?


hi there,

in a nutshell, forms work like this:

  • you add a form using the right tags to your project
  • when we build your site, we “scan” your site’s code for the appropriate form tags, if we find `em, we know you will be running a form and we make note of the settings (this is why a html version of a form must be present in your site when we build it, even if you are using a JS based SSG)
  • when a customer uses your form, we handle it as per the settings we detected on build - so if you make changes to your code, you need to deploy.

there is a lot of debugging info in here that you might find helpful:

This Support Guide is the first port of call to debug any forms issues. There are also many other Support Guides for forms - you can find them here: #Netlify-support:support-guides

If you are still having problems, please provide more information such as what you have already tried, and a link to your live form. :slight_smile:

Hi Perry, thanks. For the record, the issue was that I had to add the name=“Email”, etc. and also add the neftlify-data=“true”. I failed to add the name="" in my original. Thanks!

Nice! Thanks for sharing your fix. Let us know if we can help with anything down the road.