QuickForm2 createrule
| From: | Adam Tong | Date: | Mon, 01 Oct 2012 01:27:21 +0000 |
| Subject: | QuickForm2 createrule | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-31623@lists.php.net to get a copy of this message | ||
Hi,
I would like to know the right syntax to pass a parameter to callback
validation method.
Here is the code:
---------------
$passwd =
$fieldSet->addElement('password','passwd')->setLabel('Password:');
$passwd->addRule('required', "Please provide your password")
->and_($passwd->createRule('callback', 'Wrong password',
array($userDAO, 'checkPassword')));
--------------------
the checkPassword method will have automatically the content of the
field password but I nead to add another parameter to the function
(the user id).
Thank you