QuickForm: Name of select Elements
| From: | Marco Schuler | Date: | Thu, 10 Jun 2004 10:06:51 +0000 |
| Subject: | QuickForm: Name of select Elements | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13063@lists.php.net to get a copy of this message | ||
Hi
I got a problem using QF together with some JavaScript.
In my QF derived class, I add a selectbox like this:
$element = $this->createElement('select', 'news_id', 'News: ',
$news);
$this->addElement($element);
When I want to get the name of this element:
$elName = $element->getName();
$elName is set to news_id.
The problem I have is that I have to pass this name to a JavaScript.
This does not work. When I look at the HTML-code that QF generates, the
name of the selectbox-element is set to:
<select name="news_id[]">
So QF gives the element the name news_id[].
Why does QF add these square brackets? I have to pass the name of the
element to JavaScript within an array and that does not work with the
name that QF returns as well as when I add the square brackets to the
returned name. Can somebody point me how I can handle this?
Thanks!
--
Regards
Marco