Eric Sloane
2006-Jan-18 00:29 UTC
[Rails] That ol'' AJAX select box update again : observe_field does nothing
Hi, I know this has been asked a million times before - but I still don''t really get it. CAn someone please tell me what''s up with the following; In a view I have (apologies for the formatting); <td> <select id="job.job_phase_id" name="job[job_phase_id]"><p><label for="job_job_phase_id">Job Phase</label><br/> <%= options_from_collection_for_select @jp, "id", "description", job.job_phase_id %></p> </select></p> </td> <%= observe_field(?job.job_phase_id?, :frequency => 0.25, :update => ?action_container?, :url => { :controller => ''job'', :action => :get_action_from_phase }, :with => ??job_phase_id=?+value?) %> <td id=''action_container''> <select id="job.current_action_id" name="job[current_action_id]"><p><label for="job_current_action_id">Job Phase</label><br/> <%= options_from_collection_for_select @ja, "id", "description", job.current_action_id %></p> </select></p> </td> In the controller this; def get_action_from_phase breakpoint @ja = ActionType.find(:all, :conditions => [''job_phase_id = ?'', params[job_phase_id]]) end The prototype.js is called at the head of the shell page ; !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>The Manias Project</title> <%= stylesheet_link_tag "manias", :media => "all" %> <%= javascript_include_tag "dojo" %> <%= javascript_include_tag "prototype" %> </head> The result is that the breakpoint in the controller is never called - so observe_field is doing nothing Kind Regards, Eric
Nick Stuart
2006-Jan-18 01:27 UTC
[Rails] That ol'' AJAX select box update again : observe_field does nothing
Are you checking the logs to see if anything is getting generated when you make a change? It could be that the breakpointer isn''t working right. Check the logs first to confirm. I have an observe_field on a select box that I just did the other night and its working great and looks very similar to what you have. The only thing I question is the use of the "." in the id. I''m not sure if that would screw it up at all or not. Don''t know how it would, but you never know. -Nick "never forget the `tail -f` " S On 1/17/06, Eric Sloane <esloane@exemail.com.au> wrote:> Hi, > I know this has been asked a million times before - but I still don''t > really get it. CAn someone please tell me what''s up with the following; > > In a view I have (apologies for the formatting); > > <td> > <select id="job.job_phase_id" name="job[job_phase_id]"><p><label > for="job_job_phase_id">Job Phase</label><br/> > <%= options_from_collection_for_select @jp, "id", "description", > job.job_phase_id %></p> > </select></p> > </td> > <%= observe_field("job.job_phase_id", > :frequency => 0.25, > :update => "action_container", > :url => { :controller => ''job'', :action => > :get_action_from_phase }, > :with => "''job_phase_id=''+value") %> > > <td id=''action_container''> > <select id="job.current_action_id" > name="job[current_action_id]"><p><label for="job_current_action_id">Job > Phase</label><br/> > <%= options_from_collection_for_select @ja, "id", "description", > job.current_action_id %></p> > </select></p> > </td> > > In the controller this; > def get_action_from_phase > breakpoint > @ja = ActionType.find(:all, :conditions => [''job_phase_id = ?'', > params[job_phase_id]]) > end > > The prototype.js is called at the head of the shell page ; > > !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > <title>The Manias Project</title> > <%= stylesheet_link_tag "manias", :media => "all" %> > <%= javascript_include_tag "dojo" %> > <%= javascript_include_tag "prototype" %> > </head> > The result is that the breakpoint in the controller is never called - so > observe_field is doing nothing > > Kind Regards, > Eric > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Eric Sloane
2006-Jan-18 03:12 UTC
[Rails] Re: That ol'' AJAX select box update again : observe_field does nothing
Hi Nick, No - nothing in the logs at all. Maybe you could post your version of select/observe? Cheers, Eric. Nick Stuart wrote:> Are you checking the logs to see if anything is getting generated when > you make a change? It could be that the breakpointer isn''t working > right. Check the logs first to confirm. I have an observe_field on a > select box that I just did the other night and its working great and > looks very similar to what you have. > > The only thing I question is the use of the "." in the id. I''m not > sure if that would screw it up at all or not. Don''t know how it would, > but you never know. > > -Nick "never forget the `tail -f` " S > > On 1/17/06, Eric Sloane <esloane@exemail.com.au> wrote: > >>Hi, >>I know this has been asked a million times before - but I still don''t >>really get it. CAn someone please tell me what''s up with the following; >> >>In a view I have (apologies for the formatting); >> >> <td> >> <select id="job.job_phase_id" name="job[job_phase_id]"><p><label >>for="job_job_phase_id">Job Phase</label><br/> >> <%= options_from_collection_for_select @jp, "id", "description", >>job.job_phase_id %></p> >> </select></p> >> </td> >> <%= observe_field("job.job_phase_id", >> :frequency => 0.25, >> :update => "action_container", >> :url => { :controller => ''job'', :action => >>:get_action_from_phase }, >> :with => "''job_phase_id=''+value") %> >> >> <td id=''action_container''> >> <select id="job.current_action_id" >>name="job[current_action_id]"><p><label for="job_current_action_id">Job >>Phase</label><br/> >> <%= options_from_collection_for_select @ja, "id", "description", >>job.current_action_id %></p> >> </select></p> >> </td> >> >>In the controller this; >> def get_action_from_phase >> breakpoint >> @ja = ActionType.find(:all, :conditions => [''job_phase_id = ?'', >>params[job_phase_id]]) >> end >> >>The prototype.js is called at the head of the shell page ; >> >>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >>"http://www.w3.org/TR/html4/loose.dtd"> >><html> >> <head> >> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >> <title>The Manias Project</title> >> <%= stylesheet_link_tag "manias", :media => "all" %> >> <%= javascript_include_tag "dojo" %> >> <%= javascript_include_tag "prototype" %> >> </head> >>The result is that the breakpoint in the controller is never called - so >>observe_field is doing nothing >> >>Kind Regards, >>Eric >> >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >>
Nick Stuart
2006-Jan-18 13:41 UTC
[Rails] Re: That ol'' AJAX select box update again : observe_field does nothing
Yep, here''s what I got: <%= select "object", "some_id", @list_stuff_here %> <%= observe_field("object_some_id", :frequency => 0.25, :url => { :controller => "objects", :action => "change_something", :id => @object }, :with => "''some_id=''+value") %> In my layout I do <%= javascript_include_tag :defaults %> Thats pretty much it. I do have an :update attribute because I am using RJS templates do update the views instead. It should still work fine with the :update in there. -Nick On 1/17/06, Eric Sloane <esloane@exemail.com.au> wrote:> > Hi Nick, > No - nothing in the logs at all. Maybe you could post your version of > select/observe? > Cheers, > Eric. > > Nick Stuart wrote: > > Are you checking the logs to see if anything is getting generated when > > you make a change? It could be that the breakpointer isn''t working > > right. Check the logs first to confirm. I have an observe_field on a > > select box that I just did the other night and its working great and > > looks very similar to what you have. > > > > The only thing I question is the use of the "." in the id. I''m not > > sure if that would screw it up at all or not. Don''t know how it would, > > but you never know. > > > > -Nick "never forget the `tail -f` " S > > > > On 1/17/06, Eric Sloane <esloane@exemail.com.au> wrote: > > > >>Hi, > >>I know this has been asked a million times before - but I still don''t > >>really get it. CAn someone please tell me what''s up with the following; > >> > >>In a view I have (apologies for the formatting); > >> > >> <td> > >> <select id="job.job_phase_id" > name="job[job_phase_id]"><p><label > >>for="job_job_phase_id">Job Phase</label><br/> > >> <%> options_from_collection_for_select @jp, "id", "description", > >>job.job_phase_id %></p> > >> </select></p> > >> </td> > >> <%= observe_field("job.job_phase_id", > >> :frequency => 0.25, > >> :update => "action_container", > >> :url => { :controller => > ''job'', :action => > >>:get_action_from_phase }, > >> :with => "''job_phase_id=''+value") %> > >> > >> <td id=''action_container''> > >> <select id=" > job.current_action_id" > >>name="job[current_action_id]"><p><label for="job_current_action_id">Job > >>Phase</label><br/> > >> <%> options_from_collection_for_select @ja, "id", "description", > >>job.current_action_id %></p> > >> </select></p> > >> </td> > >> > >>In the controller this; > >> def get_action_from_phase > >> breakpoint > >> @ja = ActionType.find(:all, :conditions => [''job_phase_id = ?'', > >>params[job_phase_id]]) > >> end > >> > >>The prototype.js is called at the head of the shell page ; > >> > >>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > >>"http://www.w3.org/TR/html4/loose.dtd"> > >><html> > >> <head> > >> <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> > >> <title>The Manias Project</title> > >> <%= stylesheet_link_tag "manias", :media => "all" %> > >> <%= javascript_include_tag "dojo" %> > >> <%= javascript_include_tag "prototype" %> > >> </head> > >>The result is that the breakpoint in the controller is never called - so > >>observe_field is doing nothing > >> > >>Kind Regards, > >>Eric > >> > >>_______________________________________________ > >>Rails mailing list > >>Rails@lists.rubyonrails.org > >>http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060118/f26db84e/attachment.html
Eric Sloane
2006-Jan-18 23:15 UTC
[Rails] Re: That ol'' AJAX select box update again : observe_field does nothing
Thanks Nick! I have it working after a fashion - but I have an extra twist - the page I''m working on is actually a table where each row is a form in itself. I''m having trouble identifying or limiting the observe/update within each row/form. Cheers, Eric. Nick Stuart wrote:> Yep, here''s what I got: > > <%= select "object", "some_id", @list_stuff_here %> > <%= observe_field("object_some_id", :frequency => 0.25, :url => { > :controller => "objects", :action => "change_something", :id => @object > }, :with => "''some_id=''+value") %> > > In my layout I do <%= javascript_include_tag :defaults %> > > Thats pretty much it. I do have an :update attribute because I am using > RJS templates do update the views instead. It should still work fine > with the :update in there. > > -Nick > > On 1/17/06, *Eric Sloane* > <esloane@exemail.com.au > <mailto:esloane@exemail.com.au>> wrote: > > Hi Nick, > No - nothing in the logs at all. Maybe you could post your version of > select/observe? > Cheers, > Eric. > > Nick Stuart wrote: > > Are you checking the logs to see if anything is getting generated > when > > you make a change? It could be that the breakpointer isn''t working > > right. Check the logs first to confirm. I have an observe_field on a > > select box that I just did the other night and its working great > and > > looks very similar to what you have. > > > > The only thing I question is the use of the "." in the id. I''m not > > sure if that would screw it up at all or not. Don''t know how it > would, > > but you never know. > > > > -Nick "never forget the `tail -f` " S > > > > On 1/17/06, Eric Sloane > <esloane@exemail.com.au > <mailto:esloane@exemail.com.au>> wrote: > > > >>Hi, > >>I know this has been asked a million times before - but I still don''t > >>really get it. CAn someone please tell me what''s up with the > following; > >> > >>In a view I have (apologies for the formatting); > >> > >> <td> > >> <select > id="job.job_phase_id" name="job[job_phase_id]"><p><label > >>for="job_job_phase_id">Job Phase</label><br/> > >> <%> options_from_collection_for_select @jp, "id", "description", > >>job.job_phase_id %></p> > >> </select></p> > >> </td> > >> <%= observe_field(" > job.job_phase_id", > >> :frequency => 0.25, > >> :update => "action_container", > >> :url => { :controller => > ''job'', :action => > >>:get_action_from_phase }, > >> :with => > "''job_phase_id=''+value") %> > >> > >> <td id=''action_container''> > >> <select > id="job.current_action_id" > >>name="job[current_action_id]"><p><label > for="job_current_action_id">Job > >>Phase</label><br/> > >> <%> options_from_collection_for_select @ja, "id", "description", > >>job.current_action_id %></p> > >> </select></p> > >> </td> > >> > >>In the controller this; > >> def get_action_from_phase > >> breakpoint > >> @ja = ActionType.find(:all, :conditions => [''job_phase_id > = ?'', > >>params[job_phase_id]]) > >> end > >> > >>The prototype.js is called at the head of the shell page ; > >> > >>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > >>"http://www.w3.org/TR/html4/loose.dtd"> > >><html> > >> <head> > >> <meta http-equiv="Content-Type" > content="text/html; Manias Project</title> > >> <%= stylesheet_link_tag "manias", :media => "all" %> > >> <%= javascript_include_tag "dojo" %> > >> <%= javascript_include_tag "prototype" %> > >> </head> > >>The result is that the breakpoint in the controller is never > called - so > >>observe_field is doing nothing > >> > >>Kind Regards, > >>Eric > >> > >>_______________________________________________ > >>Rails mailing list > >>Rails@lists.rubyonrails.org > <mailto:Rails@lists.rubyonrails.org> > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Apparently Analagous Threads
- NewbieQ : undefined method `stringify_keys!'' Dumb Question
- file_column : _temp field always nil
- Login_Engine: trouble configuring
- Action Mailer woes
- Objective: to create a Joint Probability Table and save as a csv file (with headers).Input: A csv file (with headers) containing raw data, arranged by columns.Variable: number of bins for each column of data, default to 5 bins per column.Data