Re: QuickForm::addRule in groups
| From: | Jeroen Houben | Date: | Tue, 08 Apr 2003 13:26:32 +0000 |
| Subject: | Re: QuickForm::addRule in groups | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15024@lists.php.net to get a copy of this message | ||
Wolfram Kriesing wrote:
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()Jeroenif ($type == 'required' || $type == 'uploadedfile') { $this->_required[] = $element; }should beif ($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 asisInGroup() getGroup()etc. What do you say? Is there a reason for not using addGroupRule ?