heispsychotic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-18 18:21 UTC
optgroup and Javascript Issues
Is there a way to walk a select box that has multiple enabled and a few
optgroup mixed in with other groups?
The following seems to work without the optgroup tags in a multiselect
list box. I have tired going threw the children of the optgroup but i
was unable to pull a valid .value or .selected.
Any Ideas? Thanks.
var objGroups = document.getElementById(''groups'').childNodes;
var aSelectedGroups = new Array();
for (var i = 0; i < objGroups.length; i++) {
if (objGroups[i].selected == true) {
aSelectedGroups.push(objGroups[i].value);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---
Hey there, heispsychotic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> Is there a way to walk a select box that has multiple enabled and a few > optgroup mixed in with other groups? > > The following seems to work without the optgroup tags in a multiselect > list box. I have tired going threw the children of the optgroup but i > was unable to pull a valid .value or .selected.I''m not sure I get this. Don''t the HTMLSelectElement''s properties work for you? Can''t you just walk the options collection and test the selected attribute? Better yet, doesn''t Prototype''s $F function work properly on your <select> element? -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---