[QuickForm][Controller/Page] register(methodic)Rule();
| From: | Matthias H. Risse | Date: | Tue, 30 Sep 2003 20:12:25 +0000 |
| Subject: | [QuickForm][Controller/Page] register(methodic)Rule(); | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8151@lists.php.net to get a copy of this message | ||
!Buenas dias!
I am trying to use a custom rule in my QuickForm which is inside of a
QF_Page-class. As probably anyone I want to group my special rules in a
special class to be able to reuse them. Here is a simplified version of this
rulelib with just one rule :)
<?php
class customRules
{
function superCheck($element,$val)
{
if(isset($val)==1)
{
$ret = '1';
} else {
$ret = '0'
}
return $ret;
}
}
?>
this is the code inside my form (see above) which tries to validate the
form. It seems like the registration is well done, but for some unknown
reason i always get strange return-values which forces the QuickForm-object
to react not I expected it to do.
<?php
// .. class definitions..
// add element
$list_sixMAgo[] = &HTML_QuickForm::createElement('radio', null, null,
'Yes', '1');
$list_sixMAgo[] = &HTML_QuickForm::createElement('radio', null, null,
'No', '0');
$this->addGroup($list_sixMAgo, 'sixMAgo', 'Uhh.. something went very very
wrong..');
// register custom rules
$customRules = new customRules(); // necessary or will
registerRule()-method call the method from the (available) class
(statically)?
$this->registerRule('superCheck','function','superCheck','customRules');
// add rule
// $this->addRule('sixMAgo', 'please click this, baby!',
'superCheck');
// ..more stuff..
?>
Whats my fault?
Thank you in advance!
--M
PS: Something different: Is it possible that the renderer SmartyDynamic
(which i found on the web) is identical with the bundled
QuickForm_Renderer_Array?