HTML5电子邮件输入无法验证电子邮件地址?

ymzxtsji  于 2023-01-24  发布在  HTML5
关注(0)|答案(1)|浏览(323)

有人能帮我弄清楚为什么这个输入字段让我很痛苦吗?

<input class="form-field" placeholder="Email" type="email" name="CEMAIL" required oninvalid="setCustomValidity('Please enter a valid email address.')"/>

它会返回我的自定义消息,无论你输入什么,什么都不输入,还是输入一个完全有效的电子邮件地址。

<!DOCTYPE html>
<form action="newuserlogin.php" name="registerform" method="post">
<div class="form-title"><h1 style="width:100%;">New Customers Register</h1></div>
<p style="margin-bottom: 30px;">If you are new here then you will need to register an account with us. Please use the form on this page to register for your free acount.</p>
<input class="form-field" placeholder="First Name" type="text" name="FNAME" required />
<input class="form-field" placeholder="Last Name" type="text" name="LNAME" required />
<input class="form-field" id="pass1" placeholder="Password" type="password" name="ACCESS" required />
<input class="form-field" id="pass2" placeholder="Confirm Password" type="password" name="ACCESSCONF" required />
<input class="form-field" placeholder="Email" type="email" name="CEMAIL" required oninvalid="setCustomValidity('Please enter a valid email address.')" />
<input class="form-field" placeholder="Email Confirmation" type="email" name="CEMAILCONF" required oninvalid="setCustomValidity('Please enter a valid email address.')" />
<input class="form-field" placeholder="Phone Number" type="text" required pattern="^\s*\(?(020[7,8]{1}\)?[ ]?[1-9]{1}[0-9{2}[ ]?[0-9]{4})|(0[1-8]{1}[0-9]{3}\)?[ ]?[1-9]{1}[0-9]{2}[ ]?[0-9]{3})\s*$" name="CPHONE" oninvalid="setCustomValidity('Please enter a valid phone number with no spaces.')" />
<input class="form-field" placeholder="House Name/Number" type="text" required name="CHNAME" />
<input class="form-field" placeholder="Address Line 1" type="text" required name="ADL1" />
<input class="form-field" placeholder="Address Line 2" type="text" required name="ADL2" />
<input class="form-field" placeholder="Post Code" type="text" required name="CPOSTC" />
<h3><div class="form-title">Preferred Delivery Times</div></h3>
<p style="margin-bottom: 30px;">Could you please provide us with any delivery information you think we need to know to deliver to your property.</p>
<p><textarea class="form-field2" placeholder="Please write some specific delivery instructions" type="text" name="DSPECD" /></textarea></p>

<div class="submit-container">
<input onclick="BothFieldsIdenticalCaseSensitive('pass1','pass2');" type="image" style="float: left; width: 95%; height: auto;" name="submit" src="/demo/img/register-account.png" border="0" alt="Submit" value="Submit" /></div>
</form>
rqcrx0a6

rqcrx0a61#

你确定你有它的形式,并发送它与提交或按钮?

<form>
   <input type=email>
   <input type=submit>
 </form>
  • 这一定行得通
    **编辑:**如果你使用的是HTML5..为什么你的输入以/〉结尾...只要〉就够了...

!!!您的最后一次输入必须为“提交”类型....

相关问题