Hi, hoping someone can help me post form data to an external API. This is the demo contact form method from the gatsby-starter-netlify-cms which handles the submission:
handleSubmit = e => {
e.preventDefault()
const form = e.target
fetch('/', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: encode({
'form-name': form.getAttribute('name'),
...this.state,
}),
})
.then(() => navigate(form.getAttribute('action')))
.catch(error => alert(error))
}
I’ve set the action of the form to https://crm.zoho.eu/crm/WebToLeadForm
however, the form is posting to http://localhost:8000/https:/crm.zoho.eu/crm/WebToLeadForm
<form
name="WebToLeads"
method="post"
action="https://crm.zoho.eu/crm/WebToLeadForm"
data-netlify="true"
data-netlify-honeypot="bot-field"
onSubmit={this.handleSubmit}