From 171fdd60503d8c375507d1cc6334b6d95bcddbbc Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 18 Oct 2010 22:23:40 +0000 Subject: [PATCH] BUGFIX Using actual date format settings in DateField/TimeField->validate() messages (from r107786) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112694 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/DateField.php | 2 +- forms/TimeField.php | 2 +- lang/en_US.php | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/forms/DateField.php b/forms/DateField.php index e313d3db2..e230db50f 100755 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -330,7 +330,7 @@ JS; if(!$valid) { $validator->validationError( $this->name, - _t('DateField.VALIDDATEFORMAT', "Please enter a valid date format (DD/MM/YYYY)."), + _t('DateField.VALIDDATEFORMAT2', sprintf("Please enter a valid date format (%s).", $this->getConfig('dateformat'))), "validation", false ); diff --git a/forms/TimeField.php b/forms/TimeField.php index 2c26391ee..9a90de193 100755 --- a/forms/TimeField.php +++ b/forms/TimeField.php @@ -146,7 +146,7 @@ class TimeField extends TextField { if(!Zend_Date::isDate($this->value, $this->getConfig('timeformat'), $this->locale)) { $validator->validationError( $this->name, - _t('DateField.VALIDDATEFORMAT', "Please enter a valid time format."), + _t('TimeField.VALIDDATEFORMAT', sprintf("Please enter a valid time format (%s)", $this->getConfig('timeformat'))), "validation", false ); diff --git a/lang/en_US.php b/lang/en_US.php index 106ce3ab2..b73dc61ab 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -152,6 +152,7 @@ $lang['en_US']['DateField']['NOTSET'] = 'not set'; $lang['en_US']['DateField']['TODAY'] = 'today'; $lang['en_US']['DateField']['VALIDATIONJS'] = 'Please enter a valid date format (DD/MM/YYYY).'; $lang['en_US']['DateField']['VALIDDATEFORMAT'] = 'Please enter a valid time format.'; +$lang['en_US']['DateField']['VALIDDATEFORMAT2'] = 'Please enter a valid time format (%s)'; $lang['en_US']['DateField']['VALIDDATEMAXDATE'] = 'Your date has to be older or matching the maximum allowed date (%s)'; $lang['en_US']['DateField']['VALIDDATEMINDATE'] = 'Your date has to be newer or matching the minimum allowed date (%s)'; $lang['en_US']['DropdownField']['CHOOSE'] = array( @@ -810,6 +811,7 @@ $lang['en_US']['TableListField_PageControls.ss']['VIEWFIRST'] = 'View first'; $lang['en_US']['TableListField_PageControls.ss']['VIEWLAST'] = 'View last'; $lang['en_US']['TableListField_PageControls.ss']['VIEWNEXT'] = 'View next'; $lang['en_US']['TableListField_PageControls.ss']['VIEWPREVIOUS'] = 'View previous'; +$lang['en_US']['TimeField']['VALIDATEFORMAT'] = 'Please enter a valid time format (%s)'; $lang['en_US']['ToggleCompositeField.ss']['HIDE'] = 'Hide'; $lang['en_US']['ToggleCompositeField.ss']['SHOW'] = 'Show'; $lang['en_US']['ToggleField']['LESS'] = 'less';