From 2aec31ab8727c0732715596cbe583fc873640e5d Mon Sep 17 00:00:00 2001
From: Dan Chadwick <dan899@gmail.com>
Date: Thu, 6 Nov 2014 06:30:25 -0500
Subject: [PATCH] Issue #2016821 by DanChadwick: Fixed Webform error  message
 for time fields is italic when none of other is.

---
 components/grid.inc   |    2 +-
 components/number.inc |   16 ++++++++--------
 components/time.inc   |    5 ++---
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/components/grid.inc b/components/grid.inc
index 3e67bd4..703e6bd 100644
--- a/components/grid.inc
+++ b/components/grid.inc
@@ -471,7 +471,7 @@ function _webform_edit_grid_unique_validate($element) {
     // Fewer unique values than values means that at least one value is duplicated.
     // Fewer unique values than possible values means that there is a possible choice
     // that wasn't used.
-    form_error($element, t('<em>!title</em> is not allowed to have the same answer for more than one question.', array('!title' => $element['#title'])));
+    form_error($element, t('!title is not allowed to have the same answer for more than one question.', array('!title' => $element['#title'])));
   }
 }
 
diff --git a/components/number.inc b/components/number.inc
index 75f9c09..d9f8be8 100644
--- a/components/number.inc
+++ b/components/number.inc
@@ -585,7 +585,7 @@ function _webform_validate_number($element, &$form_state) {
   if ($value != '') {
     // First check that the entered value matches the expected value.
     if (!webform_number_format_match($value, $element['#point'], $element['#separator'])) {
-      form_error($element, t('%name field value must format numbers as "@example".', array('%name' => $element['#title'], '@example' => webform_number_format(12345.6789, $element['#decimals'], $element['#point'], $element['#separator']))));
+      form_error($element, t('!name field value must format numbers as "@example".', array('!name' => $element['#title'], '@example' => webform_number_format(12345.6789, $element['#decimals'], $element['#point'], $element['#separator']))));
       return;
     }
 
@@ -604,19 +604,19 @@ function _webform_validate_number($element, &$form_state) {
           $max = $element['#min'];
         }
         if ($numeric_value > $max || $numeric_value < $min) {
-          form_error($element, t('%name field value of @value should be in the range @min to @max.', array('%name' => $element['#title'], '@value' => $value, '@min' => $element['#min'], '@max' => $element['#max'])));
+          form_error($element, t('!name field value of @value should be in the range @min to @max.', array('!name' => $element['#title'], '@value' => $value, '@min' => $element['#min'], '@max' => $element['#max'])));
         }
       }
       elseif ($element['#max'] != '' && $numeric_value > $element['#max']) {
-        form_error($element, t('%name field value must be less than @max.', array('%name' => $element['#title'], '@max' => $element['#max'])));
+        form_error($element, t('!name field value must be less than @max.', array('!name' => $element['#title'], '@max' => $element['#max'])));
       }
       elseif ($element['#min'] != '' && $numeric_value < $element['#min']) {
-        form_error($element, t('%name field value must be greater than @min.', array('%name' => $element['#title'], '@min' => $element['#min'])));
+        form_error($element, t('!name field value must be greater than @min.', array('!name' => $element['#title'], '@min' => $element['#min'])));
       }
 
       // Integer test.
       if ($element['#integer'] && !is_int($numeric_value * 1)) {
-        form_error($element, t('%name field value of @value must be an integer.', array('%name' => $element['#title'], '@value' => $value)));
+        form_error($element, t('!name field value of @value must be an integer.', array('!name' => $element['#title'], '@value' => $value)));
       }
 
       // Step test.
@@ -629,15 +629,15 @@ function _webform_validate_number($element, &$form_state) {
           $starting_number + ($element['#step'] * 3),
         );
         if ($starting_number) {
-          form_error($element, t('%name field value must be @start plus a multiple of @step. i.e. @samples, etc.', array('%name' => $element['#title'], '@start' => $element['#min'], '@step' => $element['#step'], '@samples' => implode(', ', $samples))));
+          form_error($element, t('!name field value must be @start plus a multiple of @step. i.e. @samples, etc.', array('!name' => $element['#title'], '@start' => $element['#min'], '@step' => $element['#step'], '@samples' => implode(', ', $samples))));
         }
         else {
-          form_error($element, t('%name field value must be a multiple of @step. i.e. @samples, etc.', array('%name' => $element['#title'], '@step' => $element['#step'], '@samples' => implode(', ', $samples))));
+          form_error($element, t('!name field value must be a multiple of @step. i.e. @samples, etc.', array('!name' => $element['#title'], '@step' => $element['#step'], '@samples' => implode(', ', $samples))));
         }
       }
     }
     else {
-      form_error($element, t('%name field value of @value must be numeric.', array('%name' => $element['#title'], '@value' => $value)));
+      form_error($element, t('!name field value of @value must be numeric.', array('!name' => $element['#title'], '@value' => $value)));
     }
   }
 }
diff --git a/components/time.inc b/components/time.inc
index 74bc2eb..6dcda65 100644
--- a/components/time.inc
+++ b/components/time.inc
@@ -254,12 +254,11 @@ function theme_webform_time($variables) {
 
 function webform_validate_time($element, $form_state) {
   $form_key = $element['#webform_component']['form_key'];
-  $name = $element['#webform_component']['name'];
 
   // Check if the user filled the required fields.
   foreach ($element['#hourformat'] == '12-hour' ? array('hour', 'minute', 'ampm') : array('hour', 'minute') as $field_type) {
     if ($element[$field_type]['#value'] === '' && $element['#required']) {
-      form_error($element, t('%field field is required.', array('%field' => $name)));
+      form_error($element, t('!name field is required.', array('!name' => $element['#title'])));
       return;
     }
   }
@@ -267,7 +266,7 @@ function webform_validate_time($element, $form_state) {
   // Check for a valid time.
   if ($element['hour']['#value'] !== '' || $element['minute']['#value'] !== '') {
     if (!is_numeric($element['hour']['#value']) || !is_numeric($element['minute']['#value']) || (isset($element['ampm']) && $element['ampm']['#value'] === '')) {
-      form_error($element, t('Entered %name is not a valid time.', array('%name' => $name)));
+      form_error($element, t('Entered !name is not a valid time.', array('!name' => $element['#title'])));
       return;
     }
   }
-- 
1.7.8.msysgit.0

