Coding Online Forms Outside of the Energy.gov Drupal Environment

Follow these requirements to code forms on websites outside of the Energy.gov Drupal environment. If you want to code a webform on Energy.gov, see Energy.gov Webforms.

To meet Section 508 requirements, all form fields must have text labels associated with them using appropriate markup—including the label element and the id and for attributes. For example, a field may be coded like this:

<label for="SSN">Social Security Number:</label>
<input type=text name="SocSecNum" id="SSN">

Or

<label>Date of birth: <input type=text name="DofB"></label>

For more information, see WebAim's article on creating accessible forms.