Re: QuickForm multiple checkboxes and Javascript
| From: | Justin Patrin | Date: | Fri, 15 Apr 2005 16:22:31 +0000 |
| Subject: | Re: QuickForm multiple checkboxes and Javascript | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18766@lists.php.net to get a copy of this message | ||
On 4/15/05, Webmaster <webmaster@lindworm.de> wrote:
> Hi,
>
> I have the following problem.
>
> I select x rows from my database and dispaly them in table rows.
>
> Each Tablerow should have a checkbox field wich can be checked and sended to
> delete the database entry.
>
> Therefore I generate the checkboxes the following way.
>
> foreach($rows as $tmp)
>
> {
>
>
> $form->addElement('checkbox','line['.$tmp->id.']','Barrierefrei','','','0');
>
> }
>
> Now I get checkboxes looking like that.
>
> <input type="checkbox" name="line[12]" id="line[12]"
> value="1">
>
> <input type="checkbox" name="line[45]" id="line[45]"
> value="1">
>
> Now to my problem. Is there a way to select or deselect all Checkboxes with
> a Javascript ?
>
You can probably use getElementByType (I think this is right) to get
all checkboxes, but a better solution (IMHO) is to set up a JS array
which has the ids of all of your checkboxes.
--
Justin Patrin