HTML Guides for forms
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The multiple attribute on the <select> element is a boolean attribute and does not accept a value like "1".
On a <select>, multiple lets the user pick more than one option. Like every boolean attribute in HTML, its meaning comes from whether it is present, not from what you set it to. Writing multiple="1" makes the W3C validator complain because "1" is not one of the values the spec allows.
A boolean attribute can only appear in three forms: the name on its own (multiple), an empty string (multiple=""), or the name repeated as the value (multiple="multiple"). Values such as "1", "true", or "yes" look reasonable but none of them are valid.
Invalid example
<select name="toppings" multiple="1">
<option value="cheese">Cheese</option>
<option value="mushrooms">Mushrooms</option>
<option value="olives">Olives</option>
</select>
Valid example
<select name="toppings" multiple>
<option value="cheese">Cheese</option>
<option value="mushrooms">Mushrooms</option>
<option value="olives">Olives</option>
</select>
Dropping the value and keeping just multiple is the clearest way to write it.
The dir attribute on an <input> element is set to an empty string, and dir only accepts ltr, rtl or auto.
dir sets the direction of the text inside the field. The HTML standard treats an empty or unknown value as if the attribute were missing, so the input takes its direction from its parent and dir="" changes nothing. A bare dir with no value counts as empty too, and gets the same error.
A template that fills dir from the page language can print it empty for left-to-right languages. If the field should follow the page direction, remove the attribute. If people may type in a right-to-left script such as Arabic or Hebrew, which is common in search boxes, use dir="auto" and the browser sets the direction from the first letter typed. Add dirname when the server needs that direction too. The form then submits it as an extra field, such as q.dir=rtl.
Invalid example
<form action="/search">
<input type="search" name="q" aria-label="Search" dir="">
</form>
Valid example
Remove the attribute so the field follows the page direction:
<form action="/search">
<input type="search" name="q" aria-label="Search">
</form>
Or let the field follow the text the user types:
<form action="/search">
<input type="search" name="q" aria-label="Search" dir="auto" dirname="q.dir">
</form>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries