WebAIR

(if yes) Do you indicate that these fields are required using code? (FAC08)

Why Is This Important?

Some forms include certain fields that must be completed in order to submit the form. Such fields should be clearly indicated to the user. This will avoid them submitting the form with information missing and having to return to the form to correct it. This can be achieved using code.

How To Fix The Problem

Both WAI-ARIA and HTML5 include attributes that allow you to indicate that an input field is required. In WAI-ARIA, you can use the attribute 'aria-required' on the input field. In HTML5 you can use the attribute 'required' on the input field.

Example

// Indicating a required field by using the WAI-ARIA attribute 'aria-required' on the input field
<form id="Your login details" action="submit.php" method="post">
<label for="name">Your Name:</label>

<input type="text" name="name" id="name" aria-required="true" />
</form>

 

// Indicating a required field by using the HTML5 attribute 'required' on the input field
<form id="Your login details" action="submit.php" method="post">
<label for="name">Your Name:</label>

<input type="text" name="name" id="name" required>
</form>

Further Information

  1. http://www.w3.org/community/webed/wiki/HTML5_form_additions#required
  2. http://dev.opera.com/articles/view/introduction-to-wai-aria/
  3. http://www-03.ibm.com/able/guidelines/web/webforms.html