【问题标题】:Integrating FormSpree into GitHub Jekyll (Returns message: Form should post)将 FormSpree 集成到 GitHub Jekyll(返回消息:Form 应该发布)
【发布时间】:2020-05-12 15:02:29
【问题描述】:

我希望将联系表添加到 GitHub Jekyll 网站。我一直在听从最喜欢的答案here、YouTube 教程hereFormSpree site 的建议。

我创建了一个 FormSpree 帐户,验证了我的电子邮件地址,并创建了一个表单(获得了一个 ID)。然后,我尝试在我的 GitHub Jekyll 网站中添加一个联系表单,其代码可以看到 here。之后,我去了该代码的相应站点(here)并发送了测试表单提交。在电子邮件地址字段中,我尝试了连接到 FormSpree 的电子邮件地址和备用电子邮件地址。

无论哪种方式,在提交页面底部的“发送”按钮后,页面会刷新并显示一条错误消息:“表单应该 POST - 确保您的表单具有 method=POST 属性”。我也没有在连接到 FormSpree 的电子邮件中收到经过测试的消息。我试图研究这个错误,但没有找到解决方案。从代码 (here) 中可以看出,我相信我确实设置了一个method=POST 属性。

鉴于我无法有效地解释错误消息,我不确定如何继续。非常感谢任何有关如何成功呈现此类联系表单的建议,尤其是考虑到此错误消息!

【问题讨论】:

标签: github error-handling jekyll contact-form


【解决方案1】:

您的 HTML 中有错误:

<form action="https://formspree.io/email@gmail.com method="POST" name="sentMessage" id="contactForm" novalidate>

您的操作缺少结束双引号 ("),这会导致将您的 action 属性错误解释为 "https://formspree.io/email@gmail.com method=",并将您的实际方法错误解释为无效属性 post"

应该将上面的行替换为

<form action="https://formspree.io/email@gmail.com" method="POST" name="sentMessage" id="contactForm" novalidate>

在您的页面源代码中这样做,我能够提交表单并登陆 FormSpree 登录页面,表明您的表单需要激活。

【讨论】:

    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-26
    相关资源
    最近更新 更多