hi, this piece of code works fine in firefox but not in IE 6 and IE 7, i can''t understand why... here''s the code: function add_cat(){ var cat = $(''name_category'').value;<--- getting the value of the text field var gr = $(''sel_gr'').value;<--- getting the value of the select option value [...] } <form id="add_category" method="post" action=#> <table id="prodotti"> <tr> <td>name</td> <td colspan="2"><INPUT class="required" type="text" id="name_category" name="category" onfocus="Form.reset(''add_category'');" /></td> </tr> <tr> <td>Category</td> <td id="select_GROUP"></td><------THIS IS CREATE WITH AJAX.UPDATER <select id="sel_gr" class="validate-selection" name="GROUP" onchange="$(''error_gr'').update('''');"> <option value="0">Select Group</option> <option value="1">group1</option> <option value="2">group2</option> <option value="9">group3</option> <option value="8">group4</option> </select></td> </tr>----->END AJAX>UPDATER <tr> <td><a href=# onclick="add_art();">Aggiungi</a></td> </tr> </table> </form> In firefox if a do an alert(gr) i get the right output but in IE i get Undefined or an error... I think that the problem is that the created select via ajax.updater is the problem. cirpo --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 4/18/07, cirpo <alessandro.cinelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > <form id="add_category" method="post" action=#> > <table id="prodotti"> > > <tr> > <td>name</td> > <td colspan="2"><INPUT class="required" type="text" > id="name_category" name="category" > onfocus="Form.reset(''add_category'');" /></td> > </tr> > <tr> > <td>Category</td> > <td id="select_GROUP"></td><------THIS IS CREATE WITH AJAX.UPDATER > <select id="sel_gr" class="validate-selection" > name="GROUP" onchange="$(''error_gr'').update('''');"> > <option value="0">Select Group</option> > > <option value="1">group1</option> > <option value="2">group2</option> > <option value="9">group3</option> > <option value="8">group4</option> > </select></td> > > </tr>----->END AJAX>UPDATER > <tr> > <td><a href=# onclick="add_art();">Aggiungi</a></td> > </tr> > </table> > </form> > > In firefox if a do an alert(gr) i get the right output but in IE i > get Undefined or an error... > I think that the problem is that the created select via ajax.updater > is the problem.The updation of select options is broken in IE and opera, you are better of updating the entire select element. Try that and see how it works. HTH. Good luck. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
What he said. To add on, though, I''ve had a lot of success updating the select box with the update() function so that it''s empty and using appendChild() to add new Options to it. Just remember the order of parameters to the Option constructor is the display in the select list and then the value of the option. for example: <select id="itemList"> <option value="a">A</option> <option value="b">B</option> </select> <script type="text/javascript"> new Ajax.Request(url, { onSuccess: function(response, json) { $("itemList").update(""); // empty the select list json.options.each(function(option) { $("itemList").appendChild(new Option(option.display, option.value)) }); } }); </script> Surendra wrote:> On 4/18/07, cirpo <alessandro.cinelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> <form id="add_category" method="post" action=#> >> <table id="prodotti"> >> >> <tr> >> <td>name</td> >> <td colspan="2"><INPUT class="required" type="text" >> id="name_category" name="category" >> onfocus="Form.reset(''add_category'');" /></td> >> </tr> >> <tr> >> <td>Category</td> >> <td id="select_GROUP"></td><------THIS IS CREATE WITH AJAX.UPDATER >> <select id="sel_gr" class="validate-selection" >> name="GROUP" onchange="$(''error_gr'').update('''');"> >> <option value="0">Select Group</option> >> >> <option value="1">group1</option> >> <option value="2">group2</option> >> <option value="9">group3</option> >> <option value="8">group4</option> >> </select></td> >> >> </tr>----->END AJAX>UPDATER >> <tr> >> <td><a href=# onclick="add_art();">Aggiungi</a></td> >> </tr> >> </table> >> </form> >> >> In firefox if a do an alert(gr) i get the right output but in IE i >> get Undefined or an error... >> I think that the problem is that the created select via ajax.updater >> is the problem. >> > > The updation of select options is broken in IE and opera, you are > better of updating the entire select element. > Try that and see how it works. > > HTH. Good luck. >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---