QF update validation
| From: | Daniel Kopp | Date: | Wed, 05 Nov 2003 23:02:25 +0000 |
| Subject: | QF update validation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8797@lists.php.net to get a copy of this message | ||
Hi!
I also _had_ a problem with the new QF-module. I have a form in a
QFC-Controller. In the buildForm-function of one Form I had 2 groups which
were validated by the function checkMax which I discussed earlier here:
function checkMax ($elementName, $array, $max)
{
$count=0;
foreach ($array as $key=>$value)
if ($value!='') $count++;
if ($count>$max)
return false;
else
return true;
}
*
In buildForm I used:
$this->registerRule('checkmax', 'function', 'checkMax');
$this->addGroupRule('group',
'please either choose a value or enter a new value - not
both',
'checkmax', 1);
Before I had the validation function in the class itself (actually as a
class method). The new modul needs the function to be accessible global. So
- for me it worked to put it in a global include file (before I got a Error
Message telling me the function checkMax could not be found).
Maybe this helps someone else or maybe there is something else wrong with
the way I did it :-)
Regards
Daniel
* to get this in JS I guess I need to use the new validation class? Or does
even that not help me? Maybe someone can explain this as at least I don't
get how it is supposed to work by the provided example only. I think my
example is simple enough to make it a further 'case study'.