QuickForm any my own rule?
| From: | Martin Klaffenboeck | Date: | Wed, 13 Jul 2005 07:10:12 +0000 |
| Subject: | QuickForm any my own rule? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19956@lists.php.net to get a copy of this message | ||
Hello!
I want to add a new rule:
There is a select item 'Type' and another text item 'Company'. Now Type
is array('private', 'business'). If the User chooses business, the
Company field is required if he chooses private, the Company may be left
blank.
How can I do this?
I tried like the compare func to create my own function and do
$form->addRule(array('Company', 'Firma'), "Message.",
'callback',
'mycheckfunc');
but the function does not get called, only on
$form->addRule('Company', 'Message', ...)
it gets called. What am I doing wrong? (I found the
addRule(array(...)) for 'compare', so why doesn't it work here?)
thanks,
Martin