简体   繁体   中英

Jekyll site html form which submits to a different page but redirects to another

I have a Jekyll site and a contact page on which I made a simple form and connected it with service like FormSpree or SimpleForm which automatically sends the responses to my inbox, what I would like to do is redirect to a Thank you for your response page after the form is submitted. Attempted this in many ways like adding event listener to the submit button or using onSubmit or action properties of the form but I was only able to achieve one of the two things, either the form submits or I am redirected to the Thank You Page, unable to perform both when I have no access to the server side script which I could have used for redirection. The form is pretty basic, a few input fields and a submit button. Would appreciate any form of help.

Both services allow a hidden field, in your form, which points to the thank you URL you want to be redirected after submission.

with FormSpree use _next ( see advanced features )

<input type="hidden" name="_next" value="https://my-site.tld/thanks.html" />

with SimpleForm use redirect_to ( see the sample code in their page )

<input type='hidden' name='redirect_to' value='https://my-site.tld/thanks.html' />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM