using custom function in object for validation rule in HTML_QuickForm
| From: | Richard Harding | Date: | Fri, 11 Mar 2005 13:30:38 +0000 |
| Subject: | using custom function in object for validation rule in HTML_QuickForm | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17961@lists.php.net to get a copy of this message | ||
I saw some sample code where someone extended the HTML_QuickForm object to create a form. I am trying to duplicate the same setup with a login class. What I want to do is create custom functions in the object for validating the password and username. I am trying to add this, but can't get it to work.
I get the error:
*Fatal error*: Call to undefined function: $this->process_passwd() in */usr/share/php/HTML/QuickForm/Rule/Callback.php* on line *70**
The register rule I am trying is this:
$this->registerRule('processpasswd', 'callback', '$this->process_passwd');
Since $this is an extended quickform object I thought it might work with my custom process_passwd function.
Any ideas how I could make this work?
Code layout:
class login extends HTML_QuickForm {
show_login_form() {
// all the code for generating the form is in here including registerRule()} process_passwd($data) {
// code for checking the password is valid in this function} } Thank Rick *