Formspree form submission not working
lehmanwics opened this issue · comments
I have changed the formspree URL/email address as instructed but when I send now, I get the following error:
Failed to load resource: the server responded with a status of 400 ()
It seems it is trying to submit to formspree.io/jan.czizikow@Fmail.com as that is the email in the error console but I don't see that anywhere in the project folder.
can you check _js/scripts.js
and _includes/form.js
files? the <form>
tag should have an attribute of action="https://formspree.io/{{site.email}}"
. And js it should be (bottom of js file):
/*-------------------------------------------------------------------------*/
/* AJAX FORM SUBMIT */
/* -----------------------------------------------------------------------*/
$( "#contactForm" ).submit( function( e ) {
e.preventDefault();
// other variables
var $url = $( "#contactForm" ).attr( "action" );
$.ajax( {
url: $url,
// some more code down there
npm start seems to fix the problem, as the default email still persists on assets/js/bundle.js
.
@janczizikow, Formspree now prevents me from sending the form on a free verified account, I'm receiving:
{error: "To prevent spam, only Gold accounts may create AJAX forms."}
Might as well move away from the ajax form.
Edit: Works great after discarding the ajax form, disabled FORM_VALIDATION and AJAX FORM SUBMIT on _js/scripts.js
and modified form.html
. Redirects to a Formspree captcha and sends the form.
<form method="POST" action="https://formspree.io/{{site.email}}">
<div class="form__input half">
<label for="name">Name</label>
<input type="text" name="Name" autocomplete="name" required>
</div>
<div class="form__input input half">
<label for="email">Email</label>
<input type="email" name="Email" autocomplete="email" required>
</div>
<div class="form__input">
<label for="message">Message</label>
<textarea type="text" name="Message" rows="7" autocomplete="message" required></textarea>
</div>
<button class="btn" type="submit">Send</button>
</form>
hey @kbeflo I didn't know that formspree changed that. As you said will probably have to move away from AJAX. Shame 😞