【发布时间】:2015-04-22 21:42:50
【问题描述】:
更新问题:
我在所有字段中都添加了“必填”,除非表单仍然会提交
first@second 用作电子邮件。即使缺少 .com(或其他),它也会提交。
我如何也加入此验证?
谢谢!
原问题:
我的网站有一个注册表单,其中只有一个电子邮件字段。目前有验证器来验证输入电子邮件的正确语法,但如果该字段留空,则表单将提交。我需要在提交之前验证该字段是否为空白。如果它是空白的,应该会出现一些消息 - 类似于出现的消息,例如不包含 @ 符号。
我的演示页面是here.
表单html:
<div class='form animated flipInX'>
<h2>Sign Up</h2>
<form action="http://mydomain.us10.list-manage.com/subscribe/post" method="POST">
<input type="hidden" name="u" value="a324dfsf32erwdafdaf3dfsdsdf">
<input type="hidden" name="id" value="32df32rff2">
<input type="email" name="MERGE0" id="MERGE0" placeholder="Your Email Address" class="boxfield">
<button class='animated infinite pulse'>Let's Go!</button>
</form>
</div>
有什么建议吗?谢谢
【问题讨论】:
-
如果验证失败或者
value是'',则返回false。 -
?
标签: php jquery html forms validation