Re: hierselect.php
| From: | Keith Edmunds | Date: | Wed, 06 Aug 2003 07:25:46 +0000 |
| Subject: | Re: hierselect.php | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7041@lists.php.net to get a copy of this message | ||
On Tue, 5 Aug 2003 23:40:02 +0100
Keith Edmunds <keith@midnighthax.com> wrote:
> In the example at the head of the code for hierselect.php it says:
>
> * Ex:
> * $form->setDefaults(array('test' => array('4','15')));
> * $sel =& $form->addElement('hierselect', 'test',
> 'Test:', null,
> '/');* $mainOptions = $db->getAssoc('select pkparent, par_desc from
> parent'); * $sel->setMainOptions($mainOptions);
> *
> * $result = $db->query("select fk_parent, pkchild, chi_desc from
> child"); * while ($result->fetchInto($row)) {
> * $secOptions[$row[0]][$row[1]] = $row[2];
> * }
> * $sel->setSecOptions($secOptions);
>
> What are the defaults, 4 and 15, setting? I've tried this example, and
> it works but changing the 4 and 15 to other values makes no
> discernible difference.
To answer my own question (just in case others are wondering), 4 and 15
are the primary keys of the pre-selected values for the primary and
secondary select boxes respectively.
--
Keith Edmunds