Better Form Errors

Categories

Component ID

2476751

Component name

Better Form Errors

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

2358

Component created

Component changed

Component body

Overview

This module changes Drupal form validation error messages to a better readable format with a stylable field name.

Drupal form validation error message example

Drupal core or contributed modules such as Webform may print error messages on server-side form validation for certain fields. For example, if a form containing a required field called REQUIRED FIELD is submitted without a value for that field, server-side validation will lead to the following HTML error message:

  REQUIRED FIELD field is required.

The field name may not be easily distinguished from the rest of the message. This module changes the HTML code of the message to:

  The field <span class="message-field" lang="en">REQUIRED FIELD</span> is required.

Since the field name is spanned within a class ("message-field"), it can be styled to be easily distinguished from the rest of the message. The module comes with a style sheet that styles the field name in italic font. Of course, you can change the style to what you like in your own style sheet.

Features

Background

I have written this module because the problem #202393: Wrap field name within error message on required and maxlength fields into a class won't be fixed in Drupal 7 core.