Veena Jose
2010-Mar-03 05:18 UTC
how to obtain the index of selected item from select box?
Hai friends, I am a newbie in ROR.I hav created a select box which takes value from the databaseI dont know how to get the id or index of the value selected. Controller: class ReadingsController < ApplicationController def index @locations= Station.find(:all,:group => "state",:order =>"state") end end View: <% form_for :station ,:url => {:action => ''index'',:id => @station } do |form| %> <center><b> <%= form.label :Stations %></b> <%= form.collection_select("state", @locations, :id, :state) %> </center> <%end%> I want to display the readings according to the selected state for eg: If I select "Karnataka" from the select box i should get all the rows in that table whose state="Karnataka" My table schema is as below create_table "stations", :force => true do |t| t.string "name" t.string "unit_id" t.integer "sim_no" t.string "state" t.string "district" t.string "province" t.integer "zipcode" t.string "latitude" t.string "longitude" end Please give me a reply? -- 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.
Nitin Rajora
2010-Mar-03 08:12 UTC
Re: how to obtain the index of selected item from select box?
I wish to answer your query, but I need to know what you are performing on Readings controller''s index page ? I think you are having a list of all locations irrespective of state selected pre-displayed on index page. And on selection of a particular state from Stations collection_select you want to recalculate and display list of locations related to only SELECTED STATE.. maybe after a page refresh or AJAX operation. Correct me if I am wrong, then you''ll have the solution. NRJ On Wed, Mar 3, 2010 at 10:48 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai friends, > > I am a newbie in ROR.I hav created a select box which takes value > from the databaseI dont know how to get the id or index of the value > selected. > > Controller: > > class ReadingsController < ApplicationController > def index > @locations= Station.find(:all,:group => "state",:order =>"state") > end > end > > View: > > <% form_for :station ,:url => {:action => ''index'',:id => @station } do > |form| %> > <center><b> <%= form.label :Stations %></b> > <%= form.collection_select("state", @locations, :id, :state) %> > </center> > <%end%> > > I want to display the readings according to the selected state > for eg: If I select "Karnataka" from the select box i should get all the > rows in that table whose state="Karnataka" > > My table schema is as below > create_table "stations", :force => true do |t| > t.string "name" > t.string "unit_id" > t.integer "sim_no" > t.string "state" > t.string "district" > t.string "province" > t.integer "zipcode" > t.string "latitude" > t.string "longitude" > end > > Please give me a reply? > -- > 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.
kannav rajeev
2010-Mar-03 09:27 UTC
Re: how to obtain the index of selected item from select box?
use j query or java scripting to do so or you may saw on event change on tutorial OK On Wed, Mar 3, 2010 at 10:48 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai friends, > > I am a newbie in ROR.I hav created a select box which takes value > from the databaseI dont know how to get the id or index of the value > selected. > > Controller: > > class ReadingsController < ApplicationController > def index > @locations= Station.find(:all,:group => "state",:order =>"state") > end > end > > View: > > <% form_for :station ,:url => {:action => ''index'',:id => @station } do > |form| %> > <center><b> <%= form.label :Stations %></b> > <%= form.collection_select("state", @locations, :id, :state) %> > </center> > <%end%> > > I want to display the readings according to the selected state > for eg: If I select "Karnataka" from the select box i should get all the > rows in that table whose state="Karnataka" > > My table schema is as below > create_table "stations", :force => true do |t| > t.string "name" > t.string "unit_id" > t.integer "sim_no" > t.string "state" > t.string "district" > t.string "province" > t.integer "zipcode" > t.string "latitude" > t.string "longitude" > end > > Please give me a reply? > -- > 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. > >-- Thanks: Rajeev sharma -- 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
2010-Mar-03 10:50 UTC
Re: how to obtain the index of selected item from select box?
Hai nitin, What you think is correct.Now i am getting alllocations irrespective of state selected pre-displayed on index page. I want to display only those "districts" which are part of SELECTED state in collection_select after AJAX operation Please help me... Thanks in advance 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.
Nitin Rajora
2010-Mar-03 12:54 UTC
Re: Re: how to obtain the index of selected item from select box?
Good to know, Because AJAX is involved and you''re new in rails, I am assuming you want to have it work using Prototype library and RJS. Some pages to let you understand Prototype and JQuery AJAX frameworks in rails... http://www.slideshare.net/remy.sharp/prototype-jquery-going-from-one-to-the-other http://www.prototypejs.org/ http://wiki.github.com/madrobby/scriptaculous/ 1. Now, things you will need to make AJAX work. If you happen to have a layout file for your application, it should load the javascripts necessary to support AJAX operations. <%= javascript_include_tag :defaults %> will do it for you. It will include prototype and effects, etc. javascript files. 2. But if you do not have any layout file like application.rhtml or application.html.erb then you may also choose to put "javascript_include_tag :defaults" line directly on index.html.erb or index.rhtml file under your app/views/readings/index.html.erb or ...index.rhtml. 3. Now we are talking about ReadingsController index action with a list of all locations displayed on it in a div with id say - < div id="reading_list_div" > You need one more action which will be take one argument as selected state and will populate a new list of locations which are related to THAT PARTICULAR state and render the new list of locations via AJAX on the same index page. 4. <%= f.collection_select :state,Station.find(:all,:group => "state",:order =>"state"), :id, :name, {:include_blank =>"None", :onclick => remote_function(:url =>"/reading/show_readings_for_state", :with => "''state_id=''+this.value+''") } %> This collection select will trigger an AJAX call to your ReadingsController class for a action named - "show_readings_for_state" which you should define in the controller as, def show_readings_for_state @readings = Reading.find_all_by_state_id(params[:state_id]) respond_to do |format| format.js # this will not redirect the page but will look for javascript template named ("show_readings_for_state.rjs" inside the folder "/app/views/readings/") to execute once #@readings variable is initialized. end #End of respond_to do block end #End of action show_readings_for_state 5. Now you will need a partial file to replace old list of readings say _readings_list.html.erb inside "app/views/readings/_readings_list.html.erb" 6. And finally the rjs template which will be automatically called after variables in show_readings_for_state action are initialized.. File could be - "show_readings_for_state.rjs" inside the folder "/app/views/readings/" page.replace_html :reading_list_div, :partial=>''readings_list'' , :object=>@readings page.visual_effect :highlight, ''reading_list_div'' Maybe this will help you. Nitin. On Wed, Mar 3, 2010 at 4:20 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > Hai nitin, > > What you think is correct.Now i am getting alllocations irrespective of > state selected pre-displayed on index page. > > I want to display only those "districts" which are part of SELECTED > state in collection_select after AJAX operation > Please help me... > > Thanks in advance > > 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.
Veena Jose
2010-Mar-04 05:59 UTC
Re: Re: how to obtain the index of selected item from select box?
Thank u Nithin for your detailed explanation... But i am still not able to do the ajax functionality... I hav added <%= javascript_include_tag :defaults %> in my "admin" layout Controller : class ReadingsController < ApplicationController layout "admin" def index @time=Time.now @locations= Station.find(:all,:group => "state",:order =>"state") @district=Station.find(:all) @readings= CurrentReading.find(:all) @range=ConfigureParameter.find(:all) end def show_readings_for_state @district = Station.find_all_by_state_id(params[:state_id]) respond_to do |format| format.js end end end readings/index.html.erb <% form_for :station ,:url => {:action => ''index'',:id => @station } do |f| %> <center><b> <%= f.label :Stations %></b> <%= f.collection_select(:state, @locations, :id, :state,{},{:onclick =>remote_function(:url =>"/readings/show_readings_for_state",:with =>"''state_id=''+this.value+''")} ) %> </center> <br/><br/> <table cellpadding="5"> <tr> <th>Stations</th> <th>Time Stamp</th> <% for sensor_type in @range %> <th><%= sensor_type.Parameters %></th> <% end %> </tr> <div id="reading_list_div"> <% for loc in @district %> <tr> <td> <%=f.radio_button :contact_preference, "0", :tabindex =>loc.id %> <%=h loc.district %> </td> </tr> <%end%> </div> </table> <br/> <%end%> show_readings_for_state.rjs page.replace_html :reading_list_div, :partial=>''readings_list'' , :object=>@district page.visual_effect :highlight, ''reading_list_div'' _readings_list.html.erb <% for loc in @district %> <%= radio_button :contact_preference, "0", :tabindex =>loc.id %> <%=h loc.district %> <%end%> This is the code.please look at it and help me. Thank you, 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.
Amar Daxini
2010-Mar-04 06:44 UTC
Re: Re: how to obtain the index of selected item from select box?
Veena Jose wrote:> Thank u Nithin for your detailed explanation... > But i am still not able to do the ajax functionality... > > I hav added <%= javascript_include_tag :defaults %> in my "admin" layout > > Controller : > > class ReadingsController < ApplicationController > layout "admin" > > def index > @time=Time.now > @locations= Station.find(:all,:group => "state",:order =>"state") > @district=Station.find(:all) > @readings= CurrentReading.find(:all) > @range=ConfigureParameter.find(:all) > end >> end >Hi, If you are using jquery,you can see e.g which is similar http://github.com/amardaxini/Ajax-Demo -- 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 Jose
2010-Mar-08 07:13 UTC
Re: Re: how to obtain the index of selected item from select box?
> 3. Now we are talking about ReadingsController index action with a list > of > all locations displayed on it in a div with id say - < div > id="reading_list_div" > > You need one more action which will be take one argument as selected > state > and will populate a new list of locations which are related to THAT > PARTICULAR state and render the new list of locations via AJAX on the > same > index page.How can we do this in the controller?I followed all your steps..but in vain... Plz reply me 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.
Nitin Rajora
2010-Mar-08 07:57 UTC
Re: Re: Re: how to obtain the index of selected item from select box?
Do one thing, give me migrations or the sql dump of your database structure, and your app''s directory zip, I will try to replicate the issues you''re having and then can assist you further. Because "not able to do the ajax functionality" is a very big scope of a problem, there can be many reasons. On Mon, Mar 8, 2010 at 12:43 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > > 3. Now we are talking about ReadingsController index action with a list > > of > > all locations displayed on it in a div with id say - < div > > id="reading_list_div" > > > You need one more action which will be take one argument as selected > > state > > and will populate a new list of locations which are related to THAT > > PARTICULAR state and render the new list of locations via AJAX on the > > same > > index page. > > > > How can we do this in the controller?I followed all your steps..but in > vain... > Plz reply me > > 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.
Veena Jose
2010-Mar-08 08:33 UTC
Re: Re: Re: how to obtain the index of selected item from select box?
Hai Nitin, I am sending you the app and migrations folder.Please have a look.I know that i am asking too many questions..Sorry 4 troubling you... Thank you very much.... Veena Attachments: http://www.ruby-forum.com/attachment/4544/app_n_migrations.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.
Nitin Rajora
2010-Mar-08 09:22 UTC
Re: Re: Re: how to obtain the index of selected item from select box?
Your routes file is missing. And on which page do you need the functionality working.. ? (without css it is looking all black and white) Nitin.. On Mon, Mar 8, 2010 at 12:43 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > > 3. Now we are talking about ReadingsController index action with a list > > of > > all locations displayed on it in a div with id say - < div > > id="reading_list_div" > > > You need one more action which will be take one argument as selected > > state > > and will populate a new list of locations which are related to THAT > > PARTICULAR state and render the new list of locations via AJAX on the > > same > > index page. > > > > How can we do this in the controller?I followed all your steps..but in > vain... > Plz reply me > > 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.
Veena Jose
2010-Mar-08 09:29 UTC
Re: Re: Re: how to obtain the index of selected item from select box?
Nitin Rajora wrote:> Your routes file is missing. And on which page do you need the > functionality > working.. ? > (without css it is looking all black and white) > Nitin..Hai Nitin, I have attached the css and the config directory Thanks, Veena Attachments: http://www.ruby-forum.com/attachment/4545/new.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.
Veena Jose
2010-Mar-08 09:30 UTC
Re: Re: Re: how to obtain the index of selected item from select box?
Veena Jose wrote:> Nitin Rajora wrote: >> Your routes file is missing. And on which page do you need the >> functionality >> working.. ? >> (without css it is looking all black and white) >> Nitin.. >I want the things to be working on the readings/index -- 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.
Nitin Rajora
2010-Mar-08 13:21 UTC
Re: Re: Re: Re: how to obtain the index of selected item from select box?
Hi Veena, I wasn''t sure what was the Data you wanted to display on your Readings index page, but I have assumed following situation......... 1. Readings table initially is showing all current_readings for all stations on index page 2. There is a stations dropdown filled with all the stations inside "stations" table. 3. When user selects a particular station from the dropdown, the table showing Readings.. should be updated for current_readings specific to selected station... I have added some entries to current_readings table. Have a look, And AJAX is supposed to work on Readings/index page. I have also added a route in your routes file. Hope you can change this working AJAX structure according to your requirements I am attaching two files - 1. Zip of the dummy app I created to make AJAX work. 2. sql for the database I used. Nitin On Mon, Mar 8, 2010 at 3:00 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Veena Jose wrote: > > Nitin Rajora wrote: > >> Your routes file is missing. And on which page do you need the > >> functionality > >> working.. ? > >> (without css it is looking all black and white) > >> Nitin.. > > > I want the things to be working on the readings/index > -- > 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.
Veena Jose
2010-Mar-09 04:43 UTC
Re: Re: Re: Re: how to obtain the index of selected item from select box?
Thanku Thanku Thanku soooooooo much........You have really helped me a lot..... The thing you assumed is right for some extend. 1. Readings table initially is showing all current_readings for all stations on index page 2. There is a stations dropdown filled with all the states in the "stations" table.(eg.,Karnataka,Mumbai etc) 3.When user selects a particular state from the dropdown, the table showing Readings.. should be updated for current_readings specific to selected state...(eg. If i select "karnataka" and i hav 2 stations in Karnataka it should update the readings of those two stations for current_readings) Your explanations are very easy to understand...Thank you sooooooooo much. 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.
Nitin Rajora
2010-Mar-09 04:53 UTC
Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Sincerely, glad you made it work. Nitin. On Tue, Mar 9, 2010 at 10:13 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > Thanku Thanku Thanku soooooooo much........You have really helped me a > lot..... > The thing you assumed is right for some extend. > > 1. Readings table initially is showing all current_readings for all > stations > on index page > > 2. There is a stations dropdown filled with all the states in the > "stations" table.(eg.,Karnataka,Mumbai etc) > > 3.When user selects a particular state from the dropdown, the table > showing Readings.. should be updated for current_readings specific to > selected state...(eg. If i select "karnataka" and i hav 2 stations in > Karnataka it should update the readings of those two stations for > current_readings) > > Your explanations are very easy to understand...Thank you sooooooooo > much. > > 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.
Veena Jose
2010-Mar-09 08:52 UTC
Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Hai Nitin, I am again disturbing you.....Your code is working fine for me.But i want something like this. 1. Readings table initially is showing all current_readings for all stations on index page 2. There is a stations dropdown filled with all the states in the "stations" table.(eg.,Karnataka,Mumbai etc) 3.When user selects a particular state from the dropdown, the table showing Readings.. should be updated for current_readings specific to selected state...(eg. If i select "karnataka" and i hav 2 stations in Karnataka it should update the readings of those two stations for current_readings) When i got your code i thought i can make the change very easily.I wasted this whole morning in doing this.I don''t know where i am going wrong. Can you please help me out..... 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.
Nitin Rajora
2010-Mar-09 09:48 UTC
Re: Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Hi Veena, It is simple logic.. Instead of finding CurrentReadings by station_id, you need to find CurrentReadings for stations_id for which stations.state==SELECTED_STATE_VALUE Files are attached have a look. Nitin. On Tue, Mar 9, 2010 at 2:22 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Nitin, > > I am again disturbing you.....Your code is working fine for me.But i > want something like this. > > 1. Readings table initially is showing all current_readings for all > stations > on index page > > 2. There is a stations dropdown filled with all the states in the > "stations" table.(eg.,Karnataka,Mumbai etc) > > 3.When user selects a particular state from the dropdown, the table > showing Readings.. should be updated for current_readings specific to > selected state...(eg. If i select "karnataka" and i hav 2 stations in > Karnataka it should update the readings of those two stations for > current_readings) > > When i got your code i thought i can make the change very easily.I > wasted this whole morning in doing this.I don''t know where i am going > wrong. > > Can you please help me out..... > > 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.
Veena Jose
2010-Mar-09 10:27 UTC
Re: Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Thank you sooooooooooooooooo much.... I was stuck with some syntax error. Thanks Once Again.... Sincerely, 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 Jose
2010-Mar-09 10:59 UTC
Re: Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Hai Nitin, You have helped me a lot...... Can you please suggest me some good books or links where a newbie like me can understand Ruby on rails much better.... Thank you once again......... Sincerely, 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.
Colin Law
2010-Mar-09 13:40 UTC
Re: Re: Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
On 9 March 2010 10:59, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Nitin, > > You have helped me a lot...... > Can you please suggest me some good books or links where a newbie like > me can understand Ruby on rails much better....Try the Rails Guides at http://guides.rubyonrails.org/ Colin -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Nitin Rajora
2010-Mar-09 18:13 UTC
Re: Re: Re: Re: Re: Re: Re: how to obtain the index of selected item from select box?
Veena, I would suggest going through http://railscasts.com ......from episode 1st till the end... and keep watching the newer episodes. Ryan Bates is one of the best Rails Gurus there are.... Happy Women''s Day, Nitin. On Tue, Mar 9, 2010 at 4:29 PM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Nitin, > > You have helped me a lot...... > Can you please suggest me some good books or links where a newbie like > me can understand Ruby on rails much better.... > > Thank you once again......... > > Sincerely, > 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.