The Airspace theme comes with a contact page with a form. The layout file for this form includes this line:
<form method="POST" {{ if .use_netlify }}name="{{ printf "contact_%s" $.Language.Lang }}" action="{{ "/message_sent" | relLangURL }}" netlify netlify-honeypot="nhp"{{ else }}name="contact" action="{{ .action | safeURL }}"{{ end }}>
The key bit is the netlify
attribute.
This tells Netlify to process the form.
When the build process runs, Netlify replaces the netlify
attribute and inserts a hidden input that enables form submissions to be processed.
This should happen automatically, but in my case the form wasn’t being submitted even though the Netlify dashboard indicated that the form had been detected.
While reading the Netlify documentation related to forms, I came across information about reCAPTCHA. I remembered that I had seen reCAPTCHA in the same form layout:
{{ if .use_recaptcha -}}
<div class="form-group-h">
<input type="hidden" id="captchaResponse" name="g-recaptcha-response">
</div>
{{- end }}
Sure enough, disabling the reCAPTCHA option in the \config\_default\params.toml
file fixed the problem.
To use this reCAPTCHA functionality I would have to provide a reCAPTCHA site key in the site’s params.toml
file.
Instead, at a later date I might try enabling the Netlify-provided reCAPTCHA functionality.
The form in the Airspace template also includes the netlify-honeypot
attribute.
This informs Netlify that there is a hidden honeypot field intended to lure spambots.
If the hidden field is filled, then it can be assumed that the form was submitted by a bot not a human.