Hi, My code is as follows: <select id="criteria[<%=count%>][type_id]" style="font-size: 11px;"> <option value="0">select one</option> <%Report.get_criteria_array(report.model_list, session[:app_user_id], term_type).each{|arr|%> <option value="<%=arr[0]%>"> <%=arr[1]%> </option> <%}%> </select> <%= observe_field("criteria[#{count}][type_id]", :function => "term_selected(#{count},''#{report_key}'')")%> And the javascript that gets generated is: <select style="font-size: 11px;" id="criteria[1][type_id]"> <option value="0">select one</option> <option value="-1"> Company Name </option> </select> <script type="text/javascript"> // 1 2//<![CDATA[ 3new Form.Element.EventObserver(''criteria[1][type_id]'', function(element, value) {term_selected(1,''iEzMPeYD'')}) 4//]]> 5 </script> But the observer doesnt fire whenever i select anything from the select list. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve tested it (with an alert call instead of term_selected) and it works for me. Maybe there''s a javascript error in other part of the code? On 21 maio, 16:16, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > My code is as follows: > <select id="criteria[<%=count%>][type_id]" style="font-size: 11px;"> > <option value="0">select one</option> > <%Report.get_criteria_array(report.model_list, > session[:app_user_id], term_type).each{|arr|%> > <option value="<%=arr[0]%>"> > <%=arr[1]%> > </option> > <%}%> > </select> > <%= observe_field("criteria[#{count}][type_id]", > :function => "term_selected(#{count},''#{report_key}'')")%> > > And the javascript that gets generated is: > > <select style="font-size: 11px;" id="criteria[1][type_id]"> > <option value="0">select one</option> > <option value="-1"> Company Name </option> > </select> > <script type="text/javascript"> // > 1 > 2//<![CDATA[ > 3new Form.Element.EventObserver(''criteria[1][type_id]'', > function(element, value) {term_selected(1,''iEzMPeYD'')}) > 4//]]> > 5 > </script> > > But the observer doesnt fire whenever i select anything from the select > list. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Neha, Do you have Firebug installed? It would help (a lot) to know what JS it says is being generated. Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe that the observer on a select fires with "onChange" which means you have to tab out of the select before the observer will detect the change. On May 21, 10:28 pm, "Bill Walton" <bill.wal...-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> Hi Neha, > > Do you have Firebug installed? It would help (a lot) to know what JS it > says is being generated. > Best regards, > Bill--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fernando Lages wrote:> I''ve tested it (with an alert call instead of term_selected) and it > works for me. > Maybe there''s a javascript error in other part of the code? > > > On 21 maio, 16:16, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>My whole situation is like this: I am using extjs for my tab layouts. When i am getting a tab to be loaded i am making a call to a method and from there i do if(some condition) render :partial=>''x'' else render :partial=>''y'' end When partial ''x'' is rendered, upon some successful completion of an ajax call i then render partial ''y'' by doing render :update do |page| page.replace_html ''div_id'', :partial=>''y'' end Now the issue is in partial ''y'' i have an observer and it gets fired if am coming to that partial from x and then y. But if i come to the y partial straightaway the observer is not getting fired at all. Can someone help me with what could be the difference that is not letting the observer to fire. So the observer works in all cases except for one. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bill Walton wrote:> Hi Neha, > > Do you have Firebug installed? It would help (a lot) to know what JS it > says is being generated. > Best regards, > Bill<select style="font-size: 11px;" id="criteria[1][type_id]"> <option value="0">select one</option> <option value="-1"> Company Name </option> </select> <script type="text/javascript"> // 1 2//<![CDATA[ 3new Form.Element.EventObserver(''criteria[1][type_id]'', function(element, value) {term_selected(1,''iEzMPeYD'')}) 4//]]> 5 </script> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---