QuickForm::addRule in groups
| From: | Wolfram Kriesing | Date: | Tue, 08 Apr 2003 13:22:17 +0000 |
| Subject: | QuickForm::addRule in groups | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-15023@lists.php.net to get a copy of this message | ||
if i add a rule for an element in a group, the _required is not passed on to the group, am i right? therefore the renderer doesnt see that the element (in the group) is required
I am using the latest CVS version (which becomes v3, I guess)
i.e. this
$group[0] = HTML_QuickForm::createElement('html','info text');
$group[1] = HTML_QuickForm::createElement('textarea','input','input');
$form->addRule($group[1]->getName(),'This is required!','required');
and in the Renderer (i use an customized version of the Default-Renderer) renderElement() doesnt get the paramter $required=true passed to it.
I think the bug is in QuickForm::addRule()
if ($type == 'required' || $type == 'uploadedfile') {
$this->_required[] = $element;
}
should be
if ($type == 'required' || $type == 'uploadedfile') {
if ($this->isInGroup($element)) {
$groupName = $this->getGroup($element);
$this->_group[$groupName]->setRequired($element);
} else {
$this->_required[] = $element;
}
}
i am not an QuickForm-Expert. And i dont know if there are methods such as
isInGroup()
getGroup()
etc.
What do you say?
--
Wolfram
... opensource @ vision:produktion ...
http://opensource.visionp.de
... translating template engine ....
http://sf.net/projects/simpletpl
... authentication system ....
http://sf.net/projects/auth