Question

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>
Was it helpful?

Solution

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.

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 /> with the same effect. But with working required fields.

OTHER TIPS

Remove the content of the value attribute of<input required type="text" id="from" class="cleardefault from" name="from" **value=""** size="8px"/>.If you need to put a value in that text box,you can put placeholder

ie <input required type="text" id="from" class="cleardefault from" name="from" placeholder="From" size="8px"/>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top