[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-general
Subject: [PEAR] [QuickForm][Controller/Page] register(methodic)Rule();
From: 217.235.33.138
Date: 2003-09-30 20:12:25
[Download RAW message or body]
!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?
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic