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:
Sean Harvey 2012-04-12 12:23:18 +12:00
parent 3c70ea4922
commit 852ffcf492

View File

@ -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;
}
}
}
}