funkydan2 / alpha-church

Hugo theme for churches based on a html5up theme
https://alpha-church.netlify.app
Other
67 stars 58 forks source link

Formspree Updates break form #36

Closed brimwats1 closed 3 years ago

brimwats1 commented 3 years ago

Formspree no longer uses an email. Instead they use an endpoint like this:

https://formspree.io/f/RANDOMSTRING

I tried changing the [params.contact] to

    service = "formspree"
#    confirm_page = "/contact_thanks"
    formspree_email="f/RANDOMSTRING"

This seems to be reflected in the index.html


    <form method="POST" action="https://formspree.io/f/RANDOMSTRING">
        <div class="row gtr-50 gtr-uniform">
            <div class="col-6 col-12-mobilep">
                <input type="text" name="name" id="name" value="" aria-label="Name" placeholder="Name" />
            </div>
            <div class="col-6 col-12-mobilep">
                <input type="email" name="_replyto" id="email" value="" aria-label="Email" placeholder="Email" />
            </div>
            <div class="col-12">
                <textarea name="message" id="message" aria-label="Enter your message" placeholder="Enter your message" rows="6"></textarea>
            </div>
            <div class="col-12">
                <ul class="actions special">
                    <li><input type="submit" value="Send Message" /></li>
                </ul>
            </div>
        </div>
    </form>

But when I try to use the form on the website it redirects to a https://formspree.io/MY@EMAIL rather than the form. It asks me to login at formspree. I can't figure out how to make it go the right route tho :(

brimwats1 commented 3 years ago

for the record, this is what formspree offers as a form

<!-- modify this form HTML and place wherever you want your form -->

<form
  action="https://formspree.io/f/RANDOMSTRING"
  method="POST"
>
  <label>
    Your email:
    <input type="email" name="_replyto">
  </label>
  <label>
    Your message:
    <textarea name="message"></textarea>
  </label>

  <!-- your other form fields go here -->

  <button type="submit">Send</button>
</form>
brimwats1 commented 3 years ago

This is how anake does it, but I don't see a layouts/shortcode in alpha church:

https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/layouts/shortcodes/form-contact.html

brimwats1 commented 3 years ago

Okay whatever I did above now seems to work—but recommend an update to the main repository. Sorry I don't know how to submit a pull request or I would!!

funkydan2 commented 3 years ago

Thanks for raising this as I don't use formspree, so I didn't know of the change.

Is the only change between legacy forms and the new formspree way is that instead of having an email address in the action it's now a unique string?

If that's the case, your solution of putting /f/RANDOMSTRING as the formspree_email should work.

I'd be happy to update the theme, replacing formspree_email with form_id - as this seems to be the way forward for formspree. The only problem is this is a breaking change for legacy users...

brimwats1 commented 3 years ago

The old formspree URLs no longer work! Something I found out the hard way when I stopped getting emails for a time 😅 so it is already broken for legacy users I'd think!

funkydan2 commented 3 years ago

Can you pull this update and double-check it works as expected?

Note - I've changed the variable name from formspree_email to form_id to fit with their terminology.

brimwats1 commented 3 years ago

Confirmed fixed! Thanks so much!