Re: HTML_QuickForm
| From: | Bertrand Mansion | Date: | Sun, 02 Feb 2003 16:45:09 +0000 |
| Subject: | Re: HTML_QuickForm | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12926@lists.php.net to get a copy of this message | ||
<chief@php.net> wrote :
> Hi!
>
> HTML_QuickForm don't check checkoxes if i name them as arrays
> ('groupId[0]', 'groupId[1]' ,etc) and send them to the same form.
> Here is quick patch for it.
>
> Cheers,
> Chief
>
> Index: element.php
> ===================================================================
> RCS file: /repository/pear/HTML_QuickForm/QuickForm/element.php,v
> retrieving revision 1.11
> diff -u -r1.11 element.php
> --- element.php 27 Sep 2002 17:24:10 -0000 1.11
> +++ element.php 27 Sep 2002 17:46:32 -0000
> @@ -90,6 +90,13 @@
> $this->setLabel($elementLabel);
> }
> $vars = array_merge($_GET, $_POST);
> + foreach($vars as $key => $value) {
> + if(is_array($value)) {
> + foreach($value as $id => $val) {
> + $vars[$key.'['.$id.']'] = $val;
> + }
> + }
> + }
> if (isset($vars[$this->getName()])) {
> if (is_string($vars[$this->getName()]) && get_magic_quotes_gpc() ==
> 1) {
> $submitValue = stripslashes($vars[$this->getName()]);
>
Hi Radek,
Sorry for the time it took :)
But finally, this is working. Well, it was actually working but you had to
use groups. Now you can do whatever you want with your checkbox names.
Bertrand Mansion
Mamasam