Re: Couple of questions
| From: | Chris Boget | Date: | Thu, 24 Oct 2002 18:04:03 +0000 |
| Subject: | Re: Couple of questions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121324@lists.php.net to get a copy of this message | ||
> 1) Does anyone know of a JS mailing list that actually has a good
> amount of traffic (receives more than 10 email messages a day)?
Dunno
> 2) I'm trying to validate a checkbox element in a form. Due to using
> php to process this form, the checkbox element must have a name ending
> in square brackets...
> <input type="checkbox" value="somevalue" name="somename[]"
> />
> The problem I'm having is trying to loop thru this element to see if at
> least one of the boxes are checked....
> alert ( document.forms[0].elements['somename[]'][i].checked );
> This gives me an error. What's the proper syntax for this?
You can't do it that way. You have to access it using the element number.
Instead of "elements['somename[]']" it has to be "elements[x]".
As far as I know, there's no way around that.
Chris