diff --git a/includes/form.inc b/includes/form.inc
index 3840885..ae395d9 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1435,15 +1435,23 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
       $is_empty_string = (is_string($elements['#value']) && drupal_strlen(trim($elements['#value'])) == 0);
       $is_empty_value = ($elements['#value'] === 0);
       if ($is_empty_multiple || $is_empty_string || $is_empty_value) {
-        // Although discouraged, a #title is not mandatory for form elements. In
-        // case there is no #title, we cannot set a form error message.
-        // Instead of setting no #title, form constructors are encouraged to set
-        // #title_display to 'invisible' to improve accessibility.
-        if (isset($elements['#title'])) {
-          form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
+
+        $elements['#required_but_empty'] = TRUE;
+
+        if (!empty($elements['#required_error'])) {
+          form_error($elements, $elements['#required_error']);
         }
         else {
-          form_error($elements);
+          // Although discouraged, a #title is not mandatory for form elements. In
+          // case there is no #title, we cannot set a form error message.
+          // Instead of setting no #title, form constructors are encouraged to set
+          // #title_display to 'invisible' to improve accessibility.
+          if (isset($elements['#title'])) {
+            form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
+          }
+          else {
+            form_error($elements);
+          }
         }
       }
     }
