Problem with OOH!Forms
| From: | Markus Wolff | Date: | Tue, 12 Feb 2002 12:46:03 +0000 |
| Subject: | Problem with OOH!Forms | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-838@lists.php.net to get a copy of this message | ||
Hi there,
I´ve got quite an urgent problem with OOH!Forms: I have a selectbox with
several elements. The "multiple" attribute is set to true so the user
can choose more than one option at a time.
When I read the user input with $form->autoLoadValues() and try to
access the values submitted by the selectbox using
$form->getValue("MyElement"), all I get is the _last_ entry that was
selected.
What´s wrong here?
This is the code in question (the relevant parts of it):
[XML-File.xml]
<select name="products" frozen="false" multiple="true"
label="Choose products:">
<options>
<option value="1">Product1</option>
<option value="2">Product2</option>
<option value="3">Product3</option>
</options>
<intros errormsg="Please choose at least one product.">
<intro value="-1">Please choose...</intro>
</intros>
</select>
[/XML-File.xml]
[PHP-Script.php]
$form = new form_xmlfactory("XML-File.xml");
$form->autoLoadValues();
print_r($form->getValue("products"));
[/PHP-Script.php]
If I had selected "Product1" and "Product2", print_r() would return
"2"
only, even though "1" was selected as well.
How can I tell OOH!Forms to return all selected elements besides setting
multiple=true?
Thanks,
Markus
--
*21st Media* | Consulting, Konzeption, Produktion für die Bereiche:
Markus Wolff | Internet, Intranet, eCommerce, Content Management,
Hamburg,Germany | Softwareentwicklung, 3D-Animation, Videostreaming
http://21st.de | Tel. [+49](0)40/6887949-0, Fax: [+49](0)40/6887949-1