问题描述
我正在使用FormSubmit在我的静态网站(托管在服务器上)中创建联系表单.
I'm using FormSubmit to create a contact form in my static website (hosted on a server).
我的表单如下:
<div id="contact-area" class="container">
<h1>~$ contactme</h1>
<br>
<form action="https://formsubmit.co/c379c266434ca1a039bdf03209919395" method="POST">
<div class="form-group">
<div class="form-row">
<div class="col">
<input type="text" name="name" class="form-control" placeholder="Your name..." required>
</div>
<div class="col">
<input type="email" name="email" class="form-control" placeholder="Your e-mail" required>
</div>
</div>
</div>
<div class="form-group">
<textarea maxlength="1000" placeholder="Your message..." class="form-control" name="message" rows="10" required></textarea>
</div>
<input type="hidden" name="_template" value="table">
<input type="text" name="_honey" style="display:none">
<input type="hidden" name="_captcha" value="false">
<input type="hidden" name="_next" value="message_sent.html">
<button type="submit" class="btn btn-lg btn-dark btn-block">Submit</button>
</form>
</div>
我的电子邮件已通过验证.当用户单击提交"按钮时,此消息将显示在新页面中:
My email is verified. When the user clicks on submit button, this message appears in a new page:
"确保您的表单具有方法="POST".属性"
" Make sure your form has the method="POST" attribute "
但是,我收到了消息.那真是怪了.任何人都知道为什么它说我的表单应该具有POST属性,而我的表单实际上却具有post属性.
However, I receive the message. That's weird. Anyone know why it says my form should have POST attribute while my form actually has the post attribute.
推荐答案
您的代码段还可以.我已经对其进行了测试,正在提交表单,除了您实现"_next"的方式外,没有其他任何错误.特征.正如FormSubmit文档明确提到的那样,您必须提供替代URL,而不仅仅是路径或文件,它应该是URL.
Your code snippet is all okay. I have tested it, forms are getting submitted, and nothing wrong except the way you implement the "_next" feature. As FormSubmit documentation clearly mentioned you have to provide an alternative URL not just a path or file, it should be a URL.
<input type="hidden" name="_next" value="https://yourdomain.co/thanks.html">
请将您表单中的隐藏文件更改为:
Please change the hidden filed in your form to:
<input type="hidden" name="_next" value="https://yourdomain.co/message_sent.html">
那应该可以正常工作.
FormSubmit文档: https://formsubmit.co/documentation
FormSubmit documentation: https://formsubmit.co/documentation
这篇关于FormSubmit说我的表单应该使用method = POST,但实际上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!