[Javascript] select all checkboxes script
Triche Osborne
wdlists at triche-osborne.com
Tue Feb 7 09:06:39 CST 2006
David Dorward wrote:
> On Tue, Feb 07, 2006 at 03:41:04PM +0100, Michael Borchers wrote:
>
>>>// and on the checkbox fields (all of the same id/name)
>
>
>>the script works fine, but not if the name/id is
>>
>>chkbxFldName[0], chkbxFldName[1], chkbxFldName[2] etc...!? :(
>
>
> It does say that the name / id must be the same.
>
> Having the id the same is forbidden (as is having [ or ] in an id),
> but having the name the same is the standard way of creating a control
> group in HTML.
>
> PHP just has some unusual (i.e. unlike every other standard form
> processing library) naming conventions.
Just a note here: If this form is used for PHP input-only (not a sticky
form), there's no reason for PHP's sake to add the integers as long as
the selections are sequential. In other words, naming all selections
chkbxFldName[] will produce an indexed array of chkbxFldName[0],
chkbxFldName[1], etc on the server side.
I haven't played with this on the JavaScript side to know how it would
affect this particular script, but with those two caveats, it shouldn't
mess up your PHP input.
Triche Osborne
More information about the Javascript
mailing list