For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2005 > Re: [PEAR] field names with square brackets









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] field names with square brackets
Brent Baisley

2005-06-08, 8:57 pm

Brackets are added to support multiple entries.

You can reference ANY field name in javascript by referencing it using
elements[]

document.formname.elements["counties[]"]

On Jun 8, 2005, at 1:19 AM, Ed Greenberg wrote:

> HTML_QuickForm seems to be taking my fieldnames and adding a pair of
> square brackets on the end. Thus
>
> $this-
> 10,'multiple'));
>
> results in
>
> <select size="10" multiple="multiple" name="counties[]">
> <option value="1">Hampden County, MA</option>
> <option value="2">Hampshire County, MA</option>
> ---snip---
> <option value="15">Grafton County, NH</option>
> <option value="16">Coos County, NH</option>
> </select>
>
> The problem with this is that you can't direct Javascript at
> document.formname.counties[]
>
> or even at document.formname.counties\[\]
>
> I'm imagining that the [] is a form of communication from the
> rendering part of quickform to the receiving part, probably indicating
> that multiple values are possible.
>
> Has anybody worked around the problem of applying javascript to these
> elements? We'd like a "clear" button to deselect everything in the
> select box.
>
> Justin? Any ideas?
>
> Thanks,
> </edg>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com