I created a simple page with list box and text area with conditions that all should be required.
List box are working fine, but textarea box doesn't tell that the field is required to be filled.
<!DOCTYPE html> <html> <head> <title>Ratings & Reviews</title> <body> <form> <span>Customer Service*</span> <span> <select name=customer id=aa required> <option selected="rate" value="" disabled>rate</option> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> <option value=4>4</option> <option value=5>5</option> </select> </span> <br><br> <span>Value for money*</span> <span> <select name=money id=aa required> <option selected="rate" value="" disabled>rate</option> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> <option value=4>4</option> <option value=5>5</option> </select> </span> <div> <textarea name="reviews" rows=11 cols=50 maxlength=250 required> </textarea> </div> <div id=submit> <br> <input type=submit name=submit value=submit> </div> </form> </body> </html>
If the input elements aren't inside a form tag then HTML5 required attribute will fail to work. So always put input tags inside a form along with the form encapsulation itself.
The required attribute is a boolean attribute. When present, it specifies that a text area is required/must be filled out (in order to submit the form).
<textarea> does not support the value attribute.
Just put your php open tag right after the textarea close tag.. Dont use line break.. And close php exactly before (as you have done).. This will erase all the whitespaces..
You have empty space inside text area, remove it:
<textarea name="reviews" rows=11 cols=50 maxlength=250 required ></textarea>
Fiddle demo
The problem is with the spaces between the tags. You are not supposed to give any spaces in html between these tags, otherwise browser will consider it as the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With