WebAIR

Does the form contain any required fields? (FAC05)

Why Is This Important?

Some forms include certain input 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.

How To Fix The Problem

There are several ways to indicate that a input field is required:

  1. Include the word required in the label associated with the input field (e.g. "Your name [Required]")
  2. Use the WAI-ARIA attribute 'aria-required' on the input field
  3. Use the HTML5 attribute 'required' on the input field

Example

// Indicating a required field by including the word required in the label associated with the input field
<form id="Your login details" action="submit.php" method="post">
<label for="name">Your Name [Required]:</label>

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

 

// 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