【问题标题】:Jekyll site html form which submits to a different page but redirects to anotherJekyll 网站 html 表单提交到不同的页面但重定向到另一个
【发布时间】:2018-10-10 07:16:24
【问题描述】:

我有一个 Jekyll 网站和一个联系页面,在该页面上我制作了一个简单的表单并将其与 FormSpree 或 SimpleForm 等服务连接起来,它会自动将响应发送到我的收件箱,我想做的是重定向到谢谢提交表单后的响应页面。以多种方式尝试过此操作,例如将事件侦听器添加到提交按钮或使用表单的onSubmitaction 属性,但我只能实现两件事之一,要么表单提交,要么我被重定向到谢谢您的页面,当我无法访问本可以用于重定向的服务器端脚本时,无法同时执行这两项操作。该表单非常基本,有几个输入字段和一个提交按钮。任何形式的帮助都将不胜感激。

【问题讨论】:

    标签: javascript html forms jekyll static-site


    【解决方案1】:

    这两种服务都允许在您的表单中使用隐藏字段,该字段指向您希望在提交后重定向的感谢 URL。

    与 FormSpree 一起使用 _next参见 advanced features

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

    使用 SimpleForm 使用 redirect_to查看他们页面中的 sample code

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 2017-06-26
      • 1970-01-01
      • 2013-06-14
      • 2012-12-08
      相关资源
      最近更新 更多