mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: allow only 2 and 4 digit years.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97746 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c212f40bb5
commit
f38e20a7d1
@ -71,7 +71,7 @@ Behaviour.register({
|
||||
if(day_value || month_value || year_value){
|
||||
var value = day_value + '/' + month_value + '/' + year_value;
|
||||
|
||||
if(value && value.length > 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-90-9]{2,4}\$/)) {
|
||||
if(value && value.length > 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}\$/)) {
|
||||
validationError(_CURRENT_FORM.elements[fieldName+'[Day]'],"$error","validation",false);
|
||||
return false;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ 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))
|
||||
if(!empty ($this->value) && !preg_match('/^([0-9][0-9]){1,2}\-[0-9]{1,2}\-[0-9]{1,2}$/', $this->value))
|
||||
{
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
@ -83,7 +83,7 @@ Behaviour.register({
|
||||
if(day_value || month_value || year_value){
|
||||
var value = day_value + '/' + month_value + '/' + year_value;
|
||||
|
||||
if(value && value.length > 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-90-9]{2,4}\$/)) {
|
||||
if(value && value.length > 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}\$/)) {
|
||||
validationError(_CURRENT_FORM.elements[fieldName+'[Day]'],"$error","validation",false);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user