| Bertrand Mansion 2004-04-29, 6:49 pm |
| <wfm@macscan.co.uk> wrote=A0:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>=20
>=20
> Hi,
>=20
> I am having some trouble trying to use the Quickform package to create
> a multi-line select field, with several item selected.
>=20
> I have the following code:
>=20
> $form-> addElement('select','rid','',$rec,'MULTI
PLE');
>=20
> $rec is an array. So far this produces the correct HTML.
>=20
> However I would like to preselect some of the items in this box, but I
> can't see how it works from using the PEAR manual.
>=20
> I am trying to use setSelected(), to do this by using the following
> code:
>=20
> $form->seSelected($preselected);
>=20
> I have tried an array and a comma seperated list in preselected, but no
> joy. I also tried to use setDefaults, but that did not work.
>=20
> Am I doing this completely wrong ? The PEAR manual does not provide any
> examples, so I am a bit lost here.
Hi,
IIRC, you use setDefaults(array('rid' =3D> array(1, 2, 4)));
Bertrand Mansion
Mamasam
|