From: zia mohades on
Hi everyone,

I am currently having a bit of issues when using the registerRule with the
callback function.

When I run
$this->form->registerRule('checkadmindate1', 'callback',
'validate_checkAdminDate1');

I get the following error:
*Fatal error*: Call to undefined function validate_checkAdminDate1() in *
/usr/share/php/HTML/QuickForm/Rule/Callback.php* on line *81*
*
*
My functinon validate_checkAdminDate1 , looks like this:

function validate_checkAdminDate1($givenElement) {
$date_taken_answered = $givenElement['Date_taken'];
$date_taken_notanswered = $givenElement['Date_taken_not_answered'];
if(($date_taken_answered['Y'] == "") && ($date_taken_answered['M'] == "")
&& ($date_taken_answered['d'] == "") && ($date_taken_notanswered == "")){
return false;
}
return true;
}
*
*
Any help is greatly appreciated with this!

regards


daniel
From: Christian Weiske on
Hello Daniel,


> I am currently having a bit of issues when using the registerRule
> with the callback function.
>
> When I run
> $this->form->registerRule('checkadmindate1', 'callback',
> 'validate_checkAdminDate1');
>
> I get the following error:
> *Fatal error*: Call to undefined function validate_checkAdminDate1()

Are you sure that the function is
a) not a method (in a class)
b) available (loaded) when the validation is called? Maybe you define
the function after calling validate()

--
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-