Changed at 03 June 10 / 16:10
Hi I added my methods to the Validate class, but I am getting the error
Fatal error: Call to a member function getValue() on a non-object in class.Validator.php on line 456
The problem is my function needs to get a another Datefields value to compare for validation:
Class Validate
{
Other methods etc...
function validateDate($stop_date)
{
global $form;
$stop_date = strtotime($this->ukDatetoUSDate($stop_date)); //ukDatetoUSDate is another function (method) I added to the Validate class
$start_date = strtotime($this->ukDatetoUSDate($form->getValue("startDate")));// $form is the formHandler instance
if($stop_date < $start_date)
{
// invalid
return false;
}
else
{
// valid
return true;
}
}
}
The startDate value is returned (it can be echo'd) but the error is triggered which stops the validation method working.
Any ideas?