mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR MemberDatetimeOptionsetField::validate() now passes in $validator argument instead of getting it from the form, which is how other FormFields work like CompositeField
This commit is contained in:
parent
3c70ea4922
commit
852ffcf492
@ -89,12 +89,11 @@ class MemberDatetimeOptionsetField extends OptionsetField {
|
||||
}
|
||||
}
|
||||
|
||||
function validate() {
|
||||
function validate($validator) {
|
||||
$value = isset($_POST[$this->name . '_custom']) ? $_POST[$this->name . '_custom'] : null;
|
||||
if(!$value) return true; // no custom value, don't validate
|
||||
|
||||
// Check that the current date with the date format is valid or not
|
||||
$validator = $this->form ? $this->form->getValidator() : null;
|
||||
require_once 'Zend/Date.php';
|
||||
$date = Zend_Date::now()->toString($value);
|
||||
$valid = Zend_Date::isDate($date, $value);
|
||||
@ -107,4 +106,4 @@ class MemberDatetimeOptionsetField extends OptionsetField {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user