Skip to content

Commit

Permalink
MINOR MemberDatetimeOptionsetField::validate() now passes in $validat…
Browse files Browse the repository at this point in the history
…or argument instead of getting it from the form, which is how other FormFields work like CompositeField
  • Loading branch information
Sean Harvey committed Apr 12, 2012
1 parent 3c70ea4 commit 852ffcf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions forms/MemberDatetimeOptionsetField.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ function setValue($value) {
} }
} }


function validate() { function validate($validator) {
$value = isset($_POST[$this->name . '_custom']) ? $_POST[$this->name . '_custom'] : null; $value = isset($_POST[$this->name . '_custom']) ? $_POST[$this->name . '_custom'] : null;
if(!$value) return true; // no custom value, don't validate if(!$value) return true; // no custom value, don't validate


// Check that the current date with the date format is valid or not // 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'; require_once 'Zend/Date.php';
$date = Zend_Date::now()->toString($value); $date = Zend_Date::now()->toString($value);
$valid = Zend_Date::isDate($date, $value); $valid = Zend_Date::isDate($date, $value);
Expand All @@ -107,4 +106,4 @@ function validate() {
return false; return false;
} }
} }
} }

0 comments on commit 852ffcf

Please sign in to comment.