问题描述
必需的标记不适用于以下形式.为什么?有人请帮助我.谢谢.
required tag doesn't work for the following form. why? Someone please help me. Thanks.
<form name="qquote" method="post" action="<?php $_SERVER['PHP_SELF'];?>" style="margin-left:30px">
<input required type="text" id="from" class="cleardefault from" name="from" value="From" size="8px"/>
<img src="images/arrow.png" />
<input required type="text" id="to" class="cleardefault to" name="to" value="To" size="8px"/><br />
<input type="text" id="name" class="cleardefault field" name="name" value="Name" size="26px"/><br />
<input type="text" id="phone" class="cleardefault field" name="phone" value="Phone" size="26px"/><br />
<input type="text" id="email" class="cleardefault field" name="email" value="Email" size="26px"/><br />
<input type="text" id="bedroom" class="cleardefault field" name="bedroom" value="No. of Bedrooms" size="26px"/><br />
<input type="text" id="date" class="cleardefault field" name="date" value="Moving Date" size="26px" readonly onClick="GetDate(this);"/>
<input type="submit" id="submit" class="submit" name="QuickQuote" value="" />
</form>
推荐答案
我认为您的问题是您已经在文本框中添加了一个值.意味着里面已经有东西了.它认为它充满了.
I think your problem is that you already add a value inside the textbox. Meaning there is already something in it. It thinks its filled.
如果您清空该字段并单击按钮,则会弹出警告,提示该字段为必填项.
If you empty the field and click the button a warning will pop-up saying that field is required.
从表单中删除value=
,然后重试.
Remove the value=
from your form and try again.
您还可以在输入字段之前添加文本,如下所示:
You can also add text in front of the input fields like this:
To: <input type="text" id="to" class="cleardefault to" name="to" size="8px" required /><br />
具有相同的效果.但必须填写必填字段.
To: <input type="text" id="to" class="cleardefault to" name="to" size="8px" required /><br />
with the same effect. But with working required fields.
这篇关于html required标记不适用于表单提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!