Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when submitting formspree.io from GitHub pages

Tags:

html

forms

github

I am hosting a website on GitHub pages, and when I try to submit a formspree.io form I get the following error:

error

Here is my code:

<form action="http://formspree.io/[email protected]" method="post">
  <div class="row uniform collapse-at-2">
   <div class="6u">
    <input type="text" name="_replyto" placeholder="Email">
   </div>
  </div>
  <div class="12u">
   <textarea name="Message" placeholder="Message..." rows="4" cols="50" maxlength="500"></textarea>
  </div>
  <br>
  <div style="display:none">
   <input type="hidden" name="_subject" value="New submission!">
   <input type="hidden" name="_next" value="thanks.html">
   <input type="text" name="_gotcha">
  </div>
  <div class="row uniform">
   <div class="12u">
    <ul class="actions">
     <li>
      <input type="submit" class="special" value="Send">
     </li>
    </ul>
   </div>
  </div>
 </form>

Would this be due to a code error, GitHub pages error, or a formspree error?

like image 515
CorruptComputer Avatar asked Feb 06 '16 02:02

CorruptComputer


People also ask

How does formspree work with GitHub Pages?

GitHub pages allow you to host a website directly from your GitHub repository. It can host static websites that take HTML, CSS, and JavaScript files straight from your GitHub repository. It cannot execute server-side code like PHP so we can not add a contact form that redirects to a PHP file. That is where formspree comes in.

How do I reply to form submissions in formspree?

By default, after submitting a form the user is shown the Formspree "Thank You" page. You can provide an alternative URL for that page. This value is used for the email's subject, so that you can quickly reply to submissions without having to edit the subject line each time. This value is used for the email's CC Field.

How do I sign up using formspree to create a form?

1) In formspree click the sign-up button in the top right corner and enter your email address along with a password. 3) Press the + button and enter a form name. The email input box should be auto filled with the email address used to sign up to fromspree. 4) You can then copy paste the code provided by formspree into your website.

How do I find build errors in my GitHub Pages site?

By default, your GitHub Pages site is built and deployed with a GitHub Actions workflow run unless you've configured your GitHub Pages site to use a different CI tool. To find potential build errors, you can check the workflow run for your GitHub Pages site by reviewing your repository's workflow runs.


2 Answers

Things you should do to make it work are as follows:

  • According to formspree example:

<form method="POST" action="http://formspree.io/YOUREMAILHERE">
  <input type="email" name="email" placeholder="Your email">
  <br>
  <textarea name="message" placeholder="Your message"></textarea>
  <button type="submit">Send</button>
</form>

Here put your email in "http://formspree.io/YOUREMAILHERE" after /. And if you want change name="email" to name="_replyto" this will change the senders email to a clickable link.(Helps while reading in mail)

  • If that also doesn't work and it shows that "you must use server. Formspree will not work in pages browsed as HTML pages."

Then inside your <head> tag put:

<meta name="referrer" content="origin">

Hope it works!!

All the best :)

like image 76
Gautam Gahlawat Avatar answered Oct 19 '22 11:10

Gautam Gahlawat


I had the exact same problem - add the following to your field:

<meta name="referrer" content="origin" />

This worked from me.

like image 32
user7199917 Avatar answered Oct 19 '22 13:10

user7199917