mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
add DMYDataField validate() so that it overwrite validate() defined in DateField
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45722 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4dafd5b16e
commit
f9dc7a81d7
@ -51,5 +51,20 @@ class DMYDateField extends CalendarDateField {
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
function validate($validator)
|
||||
{
|
||||
if(!empty ($this->value) && !preg_match('/^[0-90-9]{2,4}\-[0-9]{1,2}\-[0-90-9]{1,2}$/', $this->value))
|
||||
{
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
_t('DMYDateField.VALIDDATEFORMAT', "Please enter a valid date format (DD-MM-YYYY)."),
|
||||
"validation",
|
||||
false
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user