mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Removing "." from the end of validation messages
This commit is contained in:
parent
7fe0858be1
commit
5462cdaab2
@ -498,7 +498,7 @@ class Upload_Validator {
|
|||||||
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
||||||
$this->errors[] = _t(
|
$this->errors[] = _t(
|
||||||
'File.TOOLARGE',
|
'File.TOOLARGE',
|
||||||
'Filesize is too large, maximum {size} allowed.',
|
'Filesize is too large, maximum {size} allowed',
|
||||||
'Argument 1: Filesize (e.g. 1MB)',
|
'Argument 1: Filesize (e.g. 1MB)',
|
||||||
array('size' => $arg)
|
array('size' => $arg)
|
||||||
);
|
);
|
||||||
|
@ -280,7 +280,7 @@ class ConfirmedPasswordField extends FormField {
|
|||||||
if(!preg_match('/^(([a-zA-Z]+\d+)|(\d+[a-zA-Z]+))[a-zA-Z0-9]*$/',$value)) {
|
if(!preg_match('/^(([a-zA-Z]+\d+)|(\d+[a-zA-Z]+))[a-zA-Z0-9]*$/',$value)) {
|
||||||
$validator->validationError(
|
$validator->validationError(
|
||||||
'Password',
|
'Password',
|
||||||
_t('Form.VALIDATIONSTRONGPASSWORD', "Passwords must have at least one digit and one alphanumeric character."),
|
_t('Form.VALIDATIONSTRONGPASSWORD', "Passwords must have at least one digit and one alphanumeric character"),
|
||||||
"validation",
|
"validation",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ class CreditCardField extends TextField {
|
|||||||
$this->name,
|
$this->name,
|
||||||
_t(
|
_t(
|
||||||
'Form.VALIDATIONCREDITNUMBER',
|
'Form.VALIDATIONCREDITNUMBER',
|
||||||
"Please ensure you have entered the {number} credit card number correctly.",
|
"Please ensure you have entered the {number} credit card number correctly",
|
||||||
array('number' => $number)
|
array('number' => $number)
|
||||||
),
|
),
|
||||||
"validation",
|
"validation",
|
||||||
|
@ -44,7 +44,7 @@ class CurrencyField extends TextField {
|
|||||||
|
|
||||||
function validate($validator) {
|
function validate($validator) {
|
||||||
if(!empty ($this->value) && !preg_match('/^\s*(\-?\$?|\$\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/', $this->value)) {
|
if(!empty ($this->value) && !preg_match('/^\s*(\-?\$?|\$\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/', $this->value)) {
|
||||||
$validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency."), "validation", false);
|
$validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency"), "validation", false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -311,7 +311,7 @@ class DateField extends TextField {
|
|||||||
$validator->validationError(
|
$validator->validationError(
|
||||||
$this->name,
|
$this->name,
|
||||||
_t(
|
_t(
|
||||||
'DateField.VALIDDATEFORMAT2', "Please enter a valid date format ({format}).",
|
'DateField.VALIDDATEFORMAT2', "Please enter a valid date format ({format})",
|
||||||
array('format' => $this->getConfig('dateformat'))
|
array('format' => $this->getConfig('dateformat'))
|
||||||
),
|
),
|
||||||
"validation",
|
"validation",
|
||||||
|
@ -39,7 +39,7 @@ class EmailField extends TextField {
|
|||||||
if($this->value && !preg_match('/' . $pregSafePattern . '/i', $this->value)){
|
if($this->value && !preg_match('/' . $pregSafePattern . '/i', $this->value)){
|
||||||
$validator->validationError(
|
$validator->validationError(
|
||||||
$this->name,
|
$this->name,
|
||||||
_t('EmailField.VALIDATION', "Please enter an email address."),
|
_t('EmailField.VALIDATION', "Please enter an email address"),
|
||||||
"validation"
|
"validation"
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
@ -85,7 +85,7 @@ class RequiredFields extends Validator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($formField && $error) {
|
if($formField && $error) {
|
||||||
$errorMessage = sprintf(_t('Form.FIELDISREQUIRED', '%s is required').'.', strip_tags('"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'));
|
$errorMessage = sprintf(_t('Form.FIELDISREQUIRED', '%s is required'), strip_tags('"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'));
|
||||||
if($msg = $formField->getCustomValidationMessage()) {
|
if($msg = $formField->getCustomValidationMessage()) {
|
||||||
$errorMessage = $msg;
|
$errorMessage = $msg;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ class TableField extends TableListField {
|
|||||||
if(!trim($fieldObj->Value())){
|
if(!trim($fieldObj->Value())){
|
||||||
$title = $fieldObj->Title();
|
$title = $fieldObj->Title();
|
||||||
$errorMessage .= sprintf(
|
$errorMessage .= sprintf(
|
||||||
_t('TableField.ISREQUIRED', "In %s '%s' is required."),
|
_t('TableField.ISREQUIRED', "In %s '%s' is required"),
|
||||||
$this->name,
|
$this->name,
|
||||||
$title
|
$title
|
||||||
);
|
);
|
||||||
|
@ -103,10 +103,10 @@ abstract class Validator extends Object {
|
|||||||
function requireField($fieldName, $data) {
|
function requireField($fieldName, $data) {
|
||||||
if(is_array($data[$fieldName]) && count($data[$fieldName])) {
|
if(is_array($data[$fieldName]) && count($data[$fieldName])) {
|
||||||
foreach($data[$fieldName] as $componentkey => $componentVal){
|
foreach($data[$fieldName] as $componentkey => $componentVal){
|
||||||
if(!strlen($componentVal)) $this->validationError($fieldName, "$fieldName $componentkey is required.", "required");
|
if(!strlen($componentVal)) $this->validationError($fieldName, "$fieldName $componentkey is required", "required");
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required.", "required");
|
}else if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required", "required");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
14
lang/en.yml
14
lang/en.yml
@ -122,7 +122,7 @@ en:
|
|||||||
DateField:
|
DateField:
|
||||||
NOTSET: 'not set'
|
NOTSET: 'not set'
|
||||||
TODAY: today
|
TODAY: today
|
||||||
VALIDDATEFORMAT2: 'Please enter a valid date format ({format}).'
|
VALIDDATEFORMAT2: 'Please enter a valid date format ({format})'
|
||||||
VALIDDATEMAXDATE: 'Your date has to be older or matching the maximum allowed date ({date})'
|
VALIDDATEMAXDATE: 'Your date has to be older or matching the maximum allowed date ({date})'
|
||||||
VALIDDATEMINDATE: 'Your date has to be newer or matching the minimum allowed date ({date})'
|
VALIDDATEMINDATE: 'Your date has to be newer or matching the minimum allowed date ({date})'
|
||||||
Director:
|
Director:
|
||||||
@ -130,7 +130,7 @@ en:
|
|||||||
DropdownField:
|
DropdownField:
|
||||||
CHOOSE: (Choose)
|
CHOOSE: (Choose)
|
||||||
EmailField:
|
EmailField:
|
||||||
VALIDATION: 'Please enter an email address.'
|
VALIDATION: 'Please enter an email address'
|
||||||
Email_BounceRecord:
|
Email_BounceRecord:
|
||||||
PLURALNAME: 'Email Bounce Records'
|
PLURALNAME: 'Email Bounce Records'
|
||||||
SINGULARNAME: 'Email Bounce Record'
|
SINGULARNAME: 'Email Bounce Record'
|
||||||
@ -146,7 +146,7 @@ en:
|
|||||||
Name: Name
|
Name: Name
|
||||||
PLURALNAME: Files
|
PLURALNAME: Files
|
||||||
SINGULARNAME: File
|
SINGULARNAME: File
|
||||||
TOOLARGE: 'Filesize is too large, maximum {size} allowed.'
|
TOOLARGE: 'Filesize is too large, maximum {size} allowed'
|
||||||
TOOLARGESHORT: 'Filesize exceeds {size}'
|
TOOLARGESHORT: 'Filesize exceeds {size}'
|
||||||
Title: Title
|
Title: Title
|
||||||
FileIFrameField:
|
FileIFrameField:
|
||||||
@ -170,13 +170,13 @@ en:
|
|||||||
TEXT3: for
|
TEXT3: for
|
||||||
Form:
|
Form:
|
||||||
FIELDISREQUIRED: '%s is required'
|
FIELDISREQUIRED: '%s is required'
|
||||||
VALIDATIONCREDITNUMBER: 'Please ensure you have entered the {number} credit card number correctly.'
|
VALIDATIONCREDITNUMBER: 'Please ensure you have entered the {number} credit card number correctly'
|
||||||
VALIDATIONNOTUNIQUE: 'The value entered is not unique'
|
VALIDATIONNOTUNIQUE: 'The value entered is not unique'
|
||||||
VALIDATIONPASSWORDSDONTMATCH: 'Passwords don''t match'
|
VALIDATIONPASSWORDSDONTMATCH: 'Passwords don''t match'
|
||||||
VALIDATIONPASSWORDSNOTEMPTY: 'Passwords can''t be empty'
|
VALIDATIONPASSWORDSNOTEMPTY: 'Passwords can''t be empty'
|
||||||
VALIDATIONSTRONGPASSWORD: 'Passwords must have at least one digit and one alphanumeric character.'
|
VALIDATIONSTRONGPASSWORD: 'Passwords must have at least one digit and one alphanumeric character'
|
||||||
VALIDATOR: Validator
|
VALIDATOR: Validator
|
||||||
VALIDCURRENCY: 'Please enter a valid currency.'
|
VALIDCURRENCY: 'Please enter a valid currency'
|
||||||
FormField:
|
FormField:
|
||||||
NONE: none
|
NONE: none
|
||||||
GridAction:
|
GridAction:
|
||||||
@ -455,7 +455,7 @@ en:
|
|||||||
SiteTree:
|
SiteTree:
|
||||||
TABMAIN: Main
|
TABMAIN: Main
|
||||||
TableField:
|
TableField:
|
||||||
ISREQUIRED: 'In %s ''%s'' is required.'
|
ISREQUIRED: 'In %s ''%s'' is required'
|
||||||
TableField.ss:
|
TableField.ss:
|
||||||
ADD: 'Add a new row'
|
ADD: 'Add a new row'
|
||||||
TableListField:
|
TableListField:
|
||||||
|
@ -98,7 +98,7 @@ en_GB:
|
|||||||
DropdownField:
|
DropdownField:
|
||||||
CHOOSE: "(Choose)"
|
CHOOSE: "(Choose)"
|
||||||
EmailField:
|
EmailField:
|
||||||
VALIDATION: "Please enter an email address."
|
VALIDATION: "Please enter an email address"
|
||||||
File:
|
File:
|
||||||
Content: "Content"
|
Content: "Content"
|
||||||
Filename: "Filename"
|
Filename: "Filename"
|
||||||
@ -107,7 +107,7 @@ en_GB:
|
|||||||
Name: "Name"
|
Name: "Name"
|
||||||
PLURALNAME: "Files"
|
PLURALNAME: "Files"
|
||||||
SINGULARNAME: "File"
|
SINGULARNAME: "File"
|
||||||
TOOLARGE: "Filesize is too large; maximum %s is allowed."
|
TOOLARGE: "Filesize is too large; maximum %s is allowed"
|
||||||
Title: "Title"
|
Title: "Title"
|
||||||
ForgotPasswordEmail.ss:
|
ForgotPasswordEmail.ss:
|
||||||
HELLO: "Hello"
|
HELLO: "Hello"
|
||||||
@ -115,15 +115,15 @@ en_GB:
|
|||||||
TEXT2: "password reset link"
|
TEXT2: "password reset link"
|
||||||
TEXT3: "for"
|
TEXT3: "for"
|
||||||
Form:
|
Form:
|
||||||
FIELDISREQUIRED: "%s is required."
|
FIELDISREQUIRED: "%s is required"
|
||||||
VALIDATIONCREDITNUMBER: "Please ensure you have entered the %s credit card number correctly."
|
VALIDATIONCREDITNUMBER: "Please ensure you have entered the %s credit card number correctly"
|
||||||
VALIDATIONFAILED: "Validation failed"
|
VALIDATIONFAILED: "Validation failed"
|
||||||
VALIDATIONNOTUNIQUE: "The value entered is not unique"
|
VALIDATIONNOTUNIQUE: "The value entered is not unique"
|
||||||
VALIDATIONPASSWORDSDONTMATCH: "Passwords don't match"
|
VALIDATIONPASSWORDSDONTMATCH: "Passwords don't match"
|
||||||
VALIDATIONPASSWORDSNOTEMPTY: "Passwords can't be empty"
|
VALIDATIONPASSWORDSNOTEMPTY: "Passwords can't be empty"
|
||||||
VALIDATIONSTRONGPASSWORD: "Passwords must have at least one digit and one alphanumeric character."
|
VALIDATIONSTRONGPASSWORD: "Passwords must have at least one digit and one alphanumeric character"
|
||||||
VALIDATOR: "Validator"
|
VALIDATOR: "Validator"
|
||||||
VALIDCURRENCY: "Please enter a valid currency."
|
VALIDCURRENCY: "Please enter a valid currency"
|
||||||
FormField:
|
FormField:
|
||||||
NONE: "none"
|
NONE: "none"
|
||||||
Group:
|
Group:
|
||||||
@ -265,7 +265,7 @@ en_GB:
|
|||||||
SiteTree:
|
SiteTree:
|
||||||
TABMAIN: "Main"
|
TABMAIN: "Main"
|
||||||
TableField:
|
TableField:
|
||||||
ISREQUIRED: "In %s '%s' is required."
|
ISREQUIRED: "In %s '%s' is required"
|
||||||
TableField.ss:
|
TableField.ss:
|
||||||
ADD: "Add a new row"
|
ADD: "Add a new row"
|
||||||
TableListField:
|
TableListField:
|
||||||
|
@ -335,7 +335,7 @@ class UploadTest_Validator extends Upload_Validator implements TestOnly {
|
|||||||
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
||||||
$this->errors[] = _t(
|
$this->errors[] = _t(
|
||||||
'File.TOOLARGE',
|
'File.TOOLARGE',
|
||||||
'Filesize is too large, maximum {size} allowed.',
|
'Filesize is too large, maximum {size} allowed',
|
||||||
'Argument 1: Filesize (e.g. 1MB)',
|
'Argument 1: Filesize (e.g. 1MB)',
|
||||||
array('size' => $arg)
|
array('size' => $arg)
|
||||||
);
|
);
|
||||||
|
@ -204,14 +204,14 @@ class FormTest extends FunctionalTest {
|
|||||||
$this->assertPartialMatchBySelector(
|
$this->assertPartialMatchBySelector(
|
||||||
'#Email span.message',
|
'#Email span.message',
|
||||||
array(
|
array(
|
||||||
_t('EmailField.VALIDATION', "Please enter an email address.")
|
'Please enter an email address'
|
||||||
),
|
),
|
||||||
'Formfield validation shows note on field if invalid'
|
'Formfield validation shows note on field if invalid'
|
||||||
);
|
);
|
||||||
$this->assertPartialMatchBySelector(
|
$this->assertPartialMatchBySelector(
|
||||||
'#SomeRequiredField span.required',
|
'#SomeRequiredField span.required',
|
||||||
array(
|
array(
|
||||||
sprintf(_t('Form.FIELDISREQUIRED').'.','"SomeRequiredField"')
|
'"SomeRequiredField" is required'
|
||||||
),
|
),
|
||||||
'Required fields show a notification on field when left blank'
|
'Required fields show a notification on field when left blank'
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user