Re: QF group required rule on Date element
| From: | Alexey Borzov | Date: | Tue, 06 Jan 2004 19:31:42 +0000 |
| Subject: | Re: QF group required rule on Date element | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10003@lists.php.net to get a copy of this message | ||
Hi!
Mike Carter wrote:
I do not know how you store all the elements and their heirachy internally... Although the setDefaults() call works, the addGroupRule() call fails with the error "QuickForm Error: nonexistent html element".Which is true, as 'eventDate' is not present in form, only 'eventDateGroup' is. QuickForm knows nothing about what is inside groups and (mostly) treats them as a whole.
The group is defined as (I've cut out some non-essential string content):- $eventDate[] = &HTML_QuickForm::createElement('date', 'eventDate', null, array('format' => 'dMY', 'language' => $_SESSION['_lang'], 'minYear' => date('Y'), 'maxYear' => '1902', 'addEmptyOption' => true)); $eventDate[] = &HTML_QuickForm::createElement('link', 'help', '', '?', ".", array('onclick' => "", 'class' => 'helpLink')); $this->addGroup($eventDate, 'eventDateGroup',$language['L_EventDate'], null, false); I defined my 'required' rule as follows:- $this->addGroupRule('eventDate', $language['L_RequireDate'], 'required', null, 3, 'client');You should define a 'complex' rule on 'eventDateGroup', kinda what was your second example in the original mail.
Alexey, you were dubious about wether it would work to begin with; is this the problem you had in mind?I didn't have anything particular in mind: I never tried this stuff myself, but do know that grouping of groups in QuickForm was never really intended, so there are lot of places that *may* cause problems.