Quickform setSelected problem
| From: | Will Macdonald | Date: | Thu, 29 Apr 2004 10:28:24 +0000 |
| Subject: | Quickform setSelected problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12214@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I am having some trouble trying to use the Quickform package to create
a multi-line select field, with several item selected.
I have the following code:
$form->addElement('select','rid','',$rec,'MULTIPLE');
$rec is an array. So far this produces the correct HTML.
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.
I am trying to use setSelected(), to do this by using the following
code:
$form->seSelected($preselected);
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.
Am I doing this completely wrong ? The PEAR manual does not provide any
examples, so I am a bit lost here.
Will
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFAkNjIzDmkFE5SX+kRAungAJ4sZd40WRe4AaQRXz8Qe2PJ1Fr0OwCgjUZd
NFLgaRXAvRE9PndQDSvyB00=
=yop5
-----END PGP SIGNATURE-----