Overview
This module changes Drupal form validation error messages to a better readable format with a stylable field name.
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
- Clean source code:
- Does not trigger any error/warning/notice message by PHP 5.4 on all possible error levels.
- Does not trigger any warning by the Coder Review module on the "minor" severity warning level.
- Does not trigger any Interface text translatability warning.
- Interface is fully translatable. As of version 7.x-1.0, the complete German translation is available on localize.drupal.org.
- Comes with complete documentation and integrated help.
- Zero configuration required.
- The module provided replacement rules can be overridden by other modules.
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.
Project information
- Module categories: Site Structure
- 14 sites report using this module
- Created by roball on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 21 Jun 2015 at 09:03 UTC