Hi, My code is like this: <%= check_box_tag("criteria[#{count}][data_auto_complete]", "1",true) %>Private <%= observe_field("criteria[#{count}][data_auto_complete]", :url => { :action => :choose_auto_complete_selection, :type_id => type_id, :count => count, :report_key => report_key, :rcolumn => rcolumn, :data_elem => @data_elem }, :before => "Element.show(''indicator_choose_select_all_#{count}'')", :success => "Element.hide(''indicator_choose_select_all_#{count}''); document.getElementById(''_commit'').disabled =false;", :with => "''value=''+value") %> But the observer is not firing when i change the state of the check box. Another thing is that this code is coming in a partial that is rendered in a window created using extjs new Window. Any suggestions why the observer wont work but the onclick event works. -- 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 -~----------~----~----~----~------~----~------~--~---
It may be redundant, but you might try adding: :on=>''click'' :frequency=>0.25 onClick is supposed to be the default for check boxes but it won''t hurt to make it explicit. If that doesn''t help, setting the frequency will make the detection time-based rather than event-based and help make sure the change in value is detected. On May 16, 11:25 am, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > My code is like this: > <%= check_box_tag("criteria[#{count}][data_auto_complete]", "1",true) > %>Private > > <%= observe_field("criteria[#{count}][data_auto_complete]", > :url => { :action => > :choose_auto_complete_selection, :type_id => type_id, :count => count, > :report_key => report_key, :rcolumn => rcolumn, :data_elem => @data_elem}, > > :before => > "Element.show(''indicator_choose_select_all_#{count}'')", > :success => > "Element.hide(''indicator_choose_select_all_#{count}''); > document.getElementById(''_commit'').disabled =false;", > :with => "''value=''+value") %> > > But the observer is not firing when i change the state of the check box. > > Another thing is that this code is coming in a partial that is rendered > in a window created using extjs new Window. > > Any suggestions why the observer wont work but the onclick event works. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Still it didn''t work... AndyV wrote:> It may be redundant, but you might try adding: > :on=>''click'' > :frequency=>0.25 > > onClick is supposed to be the default for check boxes but it won''t > hurt to make it explicit. If that doesn''t help, setting the frequency > will make the detection time-based rather than event-based and help > make sure the change in value is detected. > > On May 16, 11:25 am, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- 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 -~----------~----~----~----~------~----~------~--~---
Have you checked the rendered HTML to see if it looks to be correct and the id''s are matching up the way you expect? If those are matching then my guess would be that the js itself has an error. Check it in FF w/Firebug. On May 16, 12:14 pm, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Still it didn''t work... > > AndyV wrote: > > It may be redundant, but you might try adding: > > :on=>''click'' > > :frequency=>0.25 > > > onClick is supposed to be the default for check boxes but it won''t > > hurt to make it explicit. If that doesn''t help, setting the frequency > > will make the detection time-based rather than event-based and help > > make sure the change in value is detected. > > > On May 16, 11:25 am, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > -- > 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 -~----------~----~----~----~------~----~------~--~---
AndyV wrote:> Have you checked the rendered HTML to see if it looks to be correct > and the id''s are matching up the way you expect? If those are > matching then my guess would be that the js itself has an error. > Check it in FF w/Firebug. > > On May 16, 12:14 pm, Neha Chopra <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Here is the javascript that is getting generated: <input type="checkbox" value="1" name="criteria[1][data_auto_complete]" id="criteria[1][data_auto_complete]" checked="checked"/> <script type="text/javascript"> // 1 2//<![CDATA[ 3new Form.Element.Observer(''criteria[1][data_auto_complete]'', 0.05, function(element, value) {Element.show(''indicator_choose_select_all_1''); new Ajax.Request(''/reporting/choose_auto_complete_selection?count=1&report_key=jAb8wnDT&type_id=-2'', {asynchronous:true, evalScripts:true, onSuccess:function(request){Element.hide(''indicator_choose_select_all_1''); document.getElementById(''_commit'').disabled =false;}, parameters:''value=''+value})}, ''click'') 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 -~----------~----~----~----~------~----~------~--~---