Does anyone know why IE is not populating a select with the code below? It''s not using innerHtml anymore, but IE still just clears the selection list where Mozilla presents the actual selection options as intended... what''s now wrong with IE? Is there another way to clear and populate options for a selection that works in IE? function json_decode(txt) { try { return eval(''(''+txt+'')''); } catch(ex) {} } function invokeLoadSelection(form, event, container, value) { if (event != null) params = event + ''&contentSection='' + $F(value); var req = new Ajax.Updater(container, form.action, { method: ''post'', postBody: params, insertion: loadSelection }); } function loadSelection(container, response) { var opts = json_decode(response); var obj = $(container); obj.options.length = 0; for( var i=0; i < opts.options.length; i++ ) { obj.options[i] = new Option(opts.options[i].name, opts.options[i].value, null, false); } Thanks, Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I don''t see any problems with that code offhand that would break it in IE. If you''d like to see an example of this in use, check out the page for my Ajax.DoubleCombo http://colin.mollenhour.com/doublecombo/index.html Colin Chris wrote:> Does anyone know why IE is not populating a select with the code below? > It''s not using innerHtml anymore, but IE still just clears the > selection list where Mozilla presents the actual selection options as > intended... what''s now wrong with IE? > > Is there another way to clear and populate options for a selection that > works in IE? > > function json_decode(txt) { > try { > return eval(''(''+txt+'')''); > } catch(ex) {} > } > > > function invokeLoadSelection(form, event, container, value) { > if (event != null) > params = event + ''&contentSection='' + $F(value); > var req = new Ajax.Updater(container, form.action, { method: > ''post'', postBody: params, insertion: loadSelection }); > } > > function loadSelection(container, response) { > var opts = json_decode(response); > var obj = $(container); > obj.options.length = 0; > for( var i=0; i < opts.options.length; i++ ) { > obj.options[i] = new Option(opts.options[i].name, > opts.options[i].value, null, false); > } > > > Thanks, > Chris > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Things are a bit weird right now. I just tried to reproduce this issue here at work, but can''t! It seems to work, so I assume I must have a typo or something in my code at home. However, if it''s a type I don''t get why it worked in Mozilla but not in IE?!? We''ll see... Thanks big time Colin! Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok, I wasn''t aware that IE is incapable of differentiating between input tags with the same id /name in different forms within one page. I had 4 forms, all containing a <select id="myid" name="myid"> tag, now on submit IE just picks the first one it finds and submits the form that one belongs to. There are indeed many good reasons why I don''t use IE. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s not really an IE issue. Element ids must be unique within a document to work properly. If you reuse ids, all sorts of mysterious problems occur. On 10/4/06, Chris <mail-LyRAhpaJHUdBDgjK7y7TUQ@public.gmane.org> wrote:> > > Ok, I wasn''t aware that IE is incapable of differentiating between > input tags with the same id /name in different forms within one page. > > I had 4 forms, all containing a <select id="myid" name="myid"> tag, now > on submit IE just picks the first one it finds and submits the form > that one belongs to. > > There are indeed many good reasons why I don''t use IE. > > Chris > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---