Re: Quickform group element default
| From: | Mike Carter | Date: | Tue, 22 Jul 2003 10:45:52 +0000 |
| Subject: | Re: Quickform group element default | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6712@lists.php.net to get a copy of this message | ||
Quoting Bertrand Mansion <bmansion@mamasam.com>:
> <mikeatwork@ukonline.co.uk> wrote :
>
> > Hi
> >
> > i have three quickform elements in a group. the three elements represent
> the
> > parts of a persons name 'title', 'firstname', 'surname'.
> >
> > $adult["title"] = &HTML_QuickForm::createElement('select',
> > 'title', '',
> > $titles);
> > $adult["firstname"] = &HTML_QuickForm::createElement('text',
> > 'firstname',
> '',
> > array('size' => 25, 'maxlength' => 30));
> > $adult["surname"] = &HTML_QuickForm::createElement('text',
> > 'surname', '',
> > array('size' => 25, 'maxlength' => 30));
> >
> > They are grouped into a group names 'adultGroup'.
> > $form->addGroup($adult, "adultGroup", $language['L_AdultName']);
> >
> > i would like to set the default only in the 'surname' box.
> >
> > Looking at
> >
>
> http://www.appelsiini.net/~tuupola/php/peardoc2/package.html.html-quickform.ht
> > ml-quickform.setdefaults.html
> > there is no explination of setting an elements default when it is within a
> > group.
> >
> > How is it done? and can the documentation be merged in to the weekly pear
> docs
> > build ? please please :-)
>
> Should be merged since a week now...
Sorry, I meant documentation about setting defaults for nested elements i a
group to the existing setDefaults() documentation.
> $default['adultGroup'] = array('surname' => 'Carter');
> $form->setDefaults($defaults);
Thanks for the quick response. Was just going to post that I'd solved it - was
trying something and had a type in my array key :-/
$form->setDefaults(array("adultGroup" => array("surname" =>
$GLOBALS['vars']['surname'])));
Regards,
Mike Carter.
--
http://www.buddasworld.co.uk
----------------------------------------------
This mail sent through http://www.ukonline.net