On Jul 24, 1:02 am, diegoturriaga <[email protected]> wrote:
> Well... first that all thanks for your reply!
>
> I'm trying to use a multidemensional javascript array... various
> arrays of input controls of type checkbox
>
> I have 10 controls with name "myarray[1][]"
> other 10 controls with name "myarray[2][]"
> other 10 controls with name "myarray[3][]"
> ...
> other 10 controls with name "myarray[n][]"
>
> And I need get al controls named iqual in an array var... something
> like:
>
> var aux = document.getElemntsByName('myarray[1][]`);
>
> but using prototype sintax... :)
>
I'm not sure if you are under a misapprehension.
The value of a 'NAME' property in HTML is a CDATA - a string of text.
It has no structure.
You are free to call an input "opt[0][]" but that is a text string,
not any kind of an array in any language.
(PHP kindly treats inputs with [] in their names specially, but that
is the server-side program, not anything to do with the page or
javascript: I don't know whether any other server-side languages do
this).
So if you want to use prototype (or any other javascript) to
manipulate these names, you must treat them as text: match them as
text, perhaps even 'eval' them. But they are not arrays in any way.
As Matt says, the nearest you can get to this in Prototype is by using
the =~ match in a CSS selector, but that will not necessarily do what
you need. Otherwise you will have to do basic Javascript text
matching, or use the suggestions others have made.
(It may be that you already understand the point I am making, in which
case, my apologies).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---