Better require field marker

Categories

Component ID

2213879

Component name

Better require field marker

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Currently, Drupal required field is indicate by a red *, according to WCAG/AODA required, the page should indicate with word like, "* means required field" etc. It's possible to do in a better way, just indicate the require field with a red "require" key word.

This can be done in Theme template.php file with code,

function YourThemeName_form_required_marker($variables){
  $attributes = array(
    'class' => 'form-required',
    'title' => t('This field is required.'),
  );
  return '<span' . drupal_attributes($attributes) . '>('.t(required).')</span>';
}

If you don't want to touch the code, then you can simply use this module, to change the require filed from red * marker, to red "require" label.

The "(Require)" marker color can be set in style sheet for some theme which doesn't set the marker color,
.form-required{
color:red;
}

which you can put into the theme style sheet file.