Hai friends, I want to know how a part of the webpage (data obtained from database) can be refreshed at periodic intervals(say 5 sec). I have tried periodically_call_remote() method.But it is not working for me. <% periodically_call_remote(:url => { :action => :show_readings_for_station }, :frequency => 5, :update => "reading_list")%> <div id="reading_list"> #my code here which obtains data from database </div> show_readings_for_station is a method in the controller..... Thanks, Veena -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 15 Mar 2010, at 13:28, Veena Jose wrote:> I want to know how a part of the webpage (data obtained from > database) can be refreshed at periodic intervals(say 5 sec). > I have tried periodically_call_remote() method.But it is not working > for me. > > <% periodically_call_remote(:url => { :action => > :show_readings_for_station }, > :frequency => 5, :update => "reading_list")%> > <div id="reading_list"> > #my code here which obtains data from database > </div> > > show_readings_for_station is a method in the controller.....You need to render the periodical executer in the page, so two things that should do it: - Add the call to periodical updater after your div element - use <%= instead of just <% <div id="reading_list"> # render the partial here, render the same partial from your show_readings_for_station method </div> <%= periodically_call_remote(:url => { :action => :show_readings_for_station }, :frequency => 5, :update => "reading_list")%> Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Veena Jose wrote:> I want to know how a part of the webpage (data obtained from > database) can be refreshed at periodic intervals(say 5 sec). > I have tried periodically_call_remote() method.But it is not working > for me. > > <% periodically_call_remote(:url => { :action => > :show_readings_for_station }, > :frequency => 5, :update => "reading_list")%> > <div id="reading_list"> > #my code here which obtains data from database > </div> > > show_readings_for_station is a method in the controller.....Just to be sure, you did put: <%= javascript_include_tag :defaults %> inside your <head></head> section right? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hai Robert, Thanks for your help.I have done what you have told me.But the problem is it refreshes only for the first time and shows some RJSerror on the webpage. readings controller def show_current_readings @range=ConfigureParameter.find(:all) if (params[:state] =="") @readings = CurrentReading.find(:all) else stations = Station.find_all_by_state(params[:state]) @readingsCurrentReading.find_all_by_station_id(stations,:order=>"station_id") end render :update do |page| page.replace_html :current_reading, :partial=>''current_readings_list'' end end readings/index.html.erb <% form_for :selected_district ,:url => {:action =>''update'',:id => @selected_district } do |f| %> <center><b> <%= f.label :Stations %></b> <%= select(:selected_district,:state, @states,{:include_blank=>''All''},{:onchange =>remote_function(:url=>"/readings/show_readings_for_station",:with =>"''state=''+this.value")} ) %> </center> <%end%> <div id="reading_list"> <% form_tag :action =>"details" do %> <div id="current_reading"> #code here </div> <%= periodically_call_remote(:url => { :action=> :show_current_readings }, :frequency => 5, :update =>"current_reading")%> </div> _current_readings_list.html.erb #this partial has the code which is inside the "current_reading" div tag I am attaching the error generated on the webpage also. Please help me Thanks veena Attachments: http://www.ruby-forum.com/attachment/4591/1.rar -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Veena, You are mentioning :update attribute in the ajax call, so in the responding action you do not need to replace the content of the div. Rails will automatically update it. use following code in your controller render :partial=>''current_readings_list'' or the second solution is just remove the :update attribute from the ajax call it will run properly. ~Naren> >On Wed, Mar 17, 2010 at 11:53 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Robert, > Thanks for your help.I have done what you have told me.But the problem > is it refreshes only for the first time and shows some RJSerror on the > webpage. > > readings controller > > def show_current_readings > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings> CurrentReading.find_all_by_station_id(stations,:order=>"station_id") > end > render :update do |page| > page.replace_html :current_reading, > :partial=>''current_readings_list'' > end > end > > > readings/index.html.erb > > <% form_for :selected_district ,:url => {:action =>''update'',:id => > @selected_district } do |f| %> > <center><b> <%= f.label :Stations %></b> > <%= select(:selected_district,:state, > @states,{:include_blank=>''All''},{:onchange > =>remote_function(:url=>"/readings/show_readings_for_station",:with > =>"''state=''+this.value")} ) %> </center> > <%end%> > > <div id="reading_list"> > <% form_tag :action =>"details" do %> > <div id="current_reading"> > #code here > </div> > <%= periodically_call_remote(:url => { :action=> :show_current_readings > }, :frequency => 5, :update =>"current_reading")%> > </div> > > _current_readings_list.html.erb > > #this partial has the code which is inside the "current_reading" div tag > > I am attaching the error generated on the webpage also. > > Please help me > > > Thanks > veena > > > > Attachments: > http://www.ruby-forum.com/attachment/4591/1.rar > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I agree with Naren. Sending name of the div - "current_reading" as the :update option in the ajax call is enough to automatically replace the contents. No need for explicitly calling replace_html in the action. However if you want to use replace_html in your action... do not send <%= periodically_call_remote(:url => { :action=> :show_current_readings }, :frequency => 5, :update =>"current_reading")%> :update=>"current_reading" good luck, Nitin. On Wed, Mar 17, 2010 at 12:16 PM, Narendra sisodiya < naren.sisodiya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Veena, > > You are mentioning :update attribute in the ajax call, so in the responding > action you do not need to replace the content of the div. Rails will > automatically update it. > > use following code in your controller > > render :partial=>''current_readings_list'' > > or the second solution is just remove the :update attribute from the ajax > call it will run properly. > > ~Naren > > >> > > On Wed, Mar 17, 2010 at 11:53 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Hai Robert, >> Thanks for your help.I have done what you have told me.But the problem >> is it refreshes only for the first time and shows some RJSerror on the >> webpage. >> >> readings controller >> >> def show_current_readings >> @range=ConfigureParameter.find(:all) >> if (params[:state] =="") >> @readings = CurrentReading.find(:all) >> else >> stations = Station.find_all_by_state(params[:state]) >> @readings>> CurrentReading.find_all_by_station_id(stations,:order=>"station_id") >> end >> render :update do |page| >> page.replace_html :current_reading, >> :partial=>''current_readings_list'' >> end >> end >> >> >> readings/index.html.erb >> >> <% form_for :selected_district ,:url => {:action =>''update'',:id => >> @selected_district } do |f| %> >> <center><b> <%= f.label :Stations %></b> >> <%= select(:selected_district,:state, >> @states,{:include_blank=>''All''},{:onchange >> =>remote_function(:url=>"/readings/show_readings_for_station",:with >> =>"''state=''+this.value")} ) %> </center> >> <%end%> >> >> <div id="reading_list"> >> <% form_tag :action =>"details" do %> >> <div id="current_reading"> >> #code here >> </div> >> <%= periodically_call_remote(:url => { :action=> :show_current_readings >> }, :frequency => 5, :update =>"current_reading")%> >> </div> >> >> _current_readings_list.html.erb >> >> #this partial has the code which is inside the "current_reading" div tag >> >> I am attaching the error generated on the webpage also. >> >> Please help me >> >> >> Thanks >> veena >> >> >> >> Attachments: >> http://www.ruby-forum.com/attachment/4591/1.rar >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hai Nitin, Now I have made the following changes in my code.But the page is not refreshing at all.What could be the problem? readings controller def show_current_readings @range=ConfigureParameter.find(:all) if (params[:state] =="") @readings = CurrentReading.find(:all) else stations = Station.find_all_by_state(params[:state]) @readings = CurrentReading.find_all_by_station_id(stations, :order=>"station_id") end render :update do |page| page.replace_html :current_reading, :partial=>''current_readings_list'' end end readings/index.html.erb <%= periodically_call_remote(:url => { :action=> :show_current_readings }, :frequency => 5)%> _current_readings.html.erb #code inside "current_reading" div tag Thanks Veena -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Veena, be clear, you want the page to refresh or the div? On Wed, Mar 17, 2010 at 3:55 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > Hai Nitin, > Now I have made the following changes in my code.But the page is not > refreshing at all.What could be the problem? > > readings controller > > def show_current_readings > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings = CurrentReading.find_all_by_station_id(stations, > :order=>"station_id") > end > render :update do |page| > page.replace_html :current_reading, > :partial=>''current_readings_list'' > end > end > > readings/index.html.erb > > <%= periodically_call_remote(:url => { :action=> :show_current_readings > }, :frequency => 5)%> > > _current_readings.html.erb > > #code inside "current_reading" div tag > > > Thanks > Veena > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bala wrote:> Veena, > > be clear, you want the page to refresh or the div?I want only apart of the page to be refreshed which is inside div -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
have you included all necessary js files? which prototype your using for Ajax? copy & paste the development.log file On Wed, Mar 17, 2010 at 6:16 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Bala wrote: > > Veena, > > > > be clear, you want the page to refresh or the div? > > I want only apart of the page to be refreshed which is inside div > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
and one more thing, please install firebug for firefox if your using, and investigate how it requests the server. On Wed, Mar 17, 2010 at 6:26 PM, Bala <bala.muthaiah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> have you included all necessary js files? which prototype your using for > Ajax? > copy & paste the development.log file > > > > On Wed, Mar 17, 2010 at 6:16 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Bala wrote: >> > Veena, >> > >> > be clear, you want the page to refresh or the div? >> >> I want only apart of the page to be refreshed which is inside div >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hai Bala, I hav looked into the development.log file.I understood that the problem as in "_current_readings_list" it is not getting the id parameter based on which it has to display the readings.I dont know whether i am correct or not. I am attaching the development.log file. controller def show_readings_for_station @range=ConfigureParameter.find(:all) if (params[:state] =="") @readings = CurrentReading.find(:all) else stations = Station.find_all_by_state(params[:state]) @readings = CurrentReading.find_all_by_station_id(stations, :order=>"station_id") end respond_to do |format| format.js end #End of respond_to do block end #End of action show_readings_for_station def show_current_readings @range=ConfigureParameter.find(:all) if (params[:state] =="") @readings = CurrentReading.find(:all) else stations = Station.find_all_by_state(params[:state]) @readings = CurrentReading.find_all_by_station_id(stations, :order=>"station_id") end render :update do |page| page.replace_html :current_reading, :partial=>''current_readings_list'' page.visual_effect :highlight, ''current_reading'' end end index.html.erb <% form_for :selected_district ,:url => {:action =>''update'',:id => @selected_district } do |f| %> <center><b> <%= f.label :Stations %></b> <%= select(:selected_district,:state, @states,{:include_blank=>''All''},{:onchange =>remote_function(:url=>"/readings/show_readings_for_station",:with =>"''state=''+this.value")} ) %> </center> <%end%> <div id="reading_list"> <% form_tag :action =>"details" do %> <div id="current_reading"> # code here </div> <%= periodically_call_remote(:url => { :action=> "show_current_readings" }, :frequency => 5)%> <%end%> </div> Can you plz tell me how can i get the id of the selected element in select tag to the action "show_current_readings"? If i am wrong plz do correct me.. Thanks, Veena Attachments: http://www.ruby-forum.com/attachment/4596/development.log -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Veena, can you post the current_readings_list codes i think you miss the point. when you call the partial file through controller, you must pass the value through locals if the varaible is not instance something like this page.replace_html :current_reading, :partial=>''current_readings_list'', :locals => {:id => params[:id]} Thu, Mar 18, 2010 at 9:53 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Bala, > > I hav looked into the development.log file.I understood that the > problem as in "_current_readings_list" it is not getting the id > parameter based on which it has to display the readings.I dont know > whether i am correct or not. > > I am attaching the development.log file. > > controller > def show_readings_for_station > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings = CurrentReading.find_all_by_station_id(stations, > :order=>"station_id") > end > respond_to do |format| > format.js > end #End of respond_to do block > end #End of action show_readings_for_station > > def show_current_readings > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings = CurrentReading.find_all_by_station_id(stations, > :order=>"station_id") > end > render :update do |page| > page.replace_html :current_reading, > :partial=>''current_readings_list'' > page.visual_effect :highlight, ''current_reading'' > end > end > > index.html.erb > > <% form_for :selected_district ,:url => {:action =>''update'',:id => > @selected_district } do |f| %> > <center><b> <%= f.label :Stations %></b> > > <%= select(:selected_district,:state, > @states,{:include_blank=>''All''},{:onchange > =>remote_function(:url=>"/readings/show_readings_for_station",:with > =>"''state=''+this.value")} ) %> > > </center> > > <%end%> > <div id="reading_list"> > <% form_tag :action =>"details" do %> > <div id="current_reading"> > # code here > </div> > <%= periodically_call_remote(:url => { :action=> > "show_current_readings" }, :frequency => 5)%> > <%end%> > </div> > > Can you plz tell me how can i get the id of the selected element in > select tag to the action "show_current_readings"? If i am wrong plz do > correct me.. > > Thanks, > Veena > > > Attachments: > http://www.ruby-forum.com/attachment/4596/development.log > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
you need to include a option , :with=>"''state=''+document.getElementById(''selected_district_state'').value") for your periodically call control.. <%= periodically_call_remote(:url => { :action=>"show_current_readings" }, :frequency => 5, :with=>"''state=''+document.getElementById(''selected_district_state'').value") %> I will send more hints later. Nitin On Thu, Mar 18, 2010 at 9:53 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Bala, > > I hav looked into the development.log file.I understood that the > problem as in "_current_readings_list" it is not getting the id > parameter based on which it has to display the readings.I dont know > whether i am correct or not. > > I am attaching the development.log file. > > controller > def show_readings_for_station > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings = CurrentReading.find_all_by_station_id(stations, > :order=>"station_id") > end > respond_to do |format| > format.js > end #End of respond_to do block > end #End of action show_readings_for_station > > def show_current_readings > @range=ConfigureParameter.find(:all) > if (params[:state] =="") > @readings = CurrentReading.find(:all) > else > stations = Station.find_all_by_state(params[:state]) > @readings = CurrentReading.find_all_by_station_id(stations, > :order=>"station_id") > end > render :update do |page| > page.replace_html :current_reading, > :partial=>''current_readings_list'' > page.visual_effect :highlight, ''current_reading'' > end > end > > index.html.erb > > <% form_for :selected_district ,:url => {:action =>''update'',:id => > @selected_district } do |f| %> > <center><b> <%= f.label :Stations %></b> > > <%= select(:selected_district,:state, > @states,{:include_blank=>''All''},{:onchange > =>remote_function(:url=>"/readings/show_readings_for_station",:with > =>"''state=''+this.value")} ) %> > > </center> > > <%end%> > <div id="reading_list"> > <% form_tag :action =>"details" do %> > <div id="current_reading"> > # code here > </div> > <%= periodically_call_remote(:url => { :action=> > "show_current_readings" }, :frequency => 5)%> > <%end%> > </div> > > Can you plz tell me how can i get the id of the selected element in > select tag to the action "show_current_readings"? If i am wrong plz do > correct me.. > > Thanks, > Veena > > > Attachments: > http://www.ruby-forum.com/attachment/4596/development.log > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you soooooooooo much Nitin. Your thing has solved my problem.... Now i am getting the id of the selected state to the "periodically_call_remote()" Thank you Bala for giving so much of help.... Thank you all..... Guys you are really great.... Thanks, Veena -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
sure keep learning.. Nitin. On Thu, Mar 18, 2010 at 3:02 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thank you soooooooooo much Nitin. Your thing has solved my problem.... > Now i am getting the id of the selected state to the > "periodically_call_remote()" > > Thank you Bala for giving so much of help.... > Thank you all..... > > Guys you are really great.... > > Thanks, > Veena > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
welcome. On Thu, Mar 18, 2010 at 3:04 PM, Nitin Rajora <nitinr708-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> sure keep learning.. > Nitin. > > > On Thu, Mar 18, 2010 at 3:02 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Thank you soooooooooo much Nitin. Your thing has solved my problem.... >> Now i am getting the id of the selected state to the >> "periodically_call_remote()" >> >> Thank you Bala for giving so much of help.... >> Thank you all..... >> >> Guys you are really great.... >> >> Thanks, >> Veena >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.