I have a search form on my rails site. once the a user has entered a query it displays the results in a table with an extra field button so it can be added to there own portfolio called add to my stocks. How do i get the data for the stock they want to add and put this into a new table called mystocks. Is using a form submit button the right choice? Any examples much appreciated Regards Nick -- 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 -~----------~----~----~----~------~----~------~--~---
#Search stock view <%form_tag(:action=>:search_stock) do%> <%=submit_tag(''Search")%> <%end%> #Search Stock Controller def search_stock @stocks = Stock.find_by_something() render action=>:result_page end #Result Page <%form_tag(:action=>:add_to_my_stocks) do %> <%@stocks.each do |stock|%> #Create set of checkbox and use stock_id as id <%end%> <%end%> On Mar 18, 1:06 pm, Nick Hoyle <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have a search form on my rails site. once the a user has entered a > query it displays the results in a table with an extra field button so > it can be added to there own portfolio called add to my stocks. > > How do i get the data for the stock they want to add and put this into a > new table called mystocks. > > Is using a form submit button the right choice? > > Any examples much appreciated > > Regards > > Nick > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nat wrote:> #Search stock view > <%form_tag(:action=>:search_stock) do%> > <%=submit_tag(''Search")%> > <%end%> > > > #Search Stock Controller > def search_stock > @stocks = Stock.find_by_something() > render action=>:result_page > end > > > #Result Page > <%form_tag(:action=>:add_to_my_stocks) do %> > <%@stocks.each do |stock|%> > #Create set of checkbox and use stock_id as id > <%end%> > <%end%> > > On Mar 18, 1:06�pm, Nick Hoyle <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Thanks for quick response How exactly do you do a checkbox with an id? <%= form.check_box :stock_id %>? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Thanks for quick response > > How exactly do you do a checkbox with an id? > > <%= form.check_box :stock_id %>?ignore me ive sorted that, was looking at a wrong example -- 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 -~----------~----~----~----~------~----~------~--~---
> > Hi all now i am doing with advanced search by using checkboxs and redio > button for each items >for example : <% form_for *:tblpss_description_record*, *@tblpss_description_record*, * :url*=>{ *:action*=>''view_detail_job_setup'' }, *:html*=>{ *:id*=> ''frm_view_setup'', *:name*=>''frm_view_setup'', *:method* => *:get*} *do*|f|%> <input type="checkbox" name="elementprovince" value="ALL" id="optPROVINCE" onclick="changeBoxesProvince(1)">ALL<br> <input type="checkbox" name="elementprovince" value="PHNOM PENH" id"optPROVINCE">PHNOM PENH<br> <input type="checkbox" name="elementprovince" value="BANTEAY MEANCHEY" id"optPROVINCE">BANTEAY MEANCHEY<br> <input type="checkbox" name="elementprovince" value="BATTAMBANG" id"optPROVINCE">BATTAMBANG<br> <input type="checkbox" name="elementprovince" value="KAMPONG CHAM" id"optPROVINCE">KAMPONG CHAM<br> <input type="checkbox" name="elementprovince" value="KAMPONG CHHNANG" id"optPROVINCE">KAMPONG CHHNANG<br> <input type="checkbox" name="elementprovince" value="KAMPONG SPEU" id"optPROVINCE">KAMPONG SPEU<br> <input type="checkbox" name="elementprovince" value="KAMPONG THOM" id"optPROVINCE">KAMPONG THOM<br> <input type="checkbox" name="elementprovince" value="KAMPOT" id"optPROVINCE">KAMPOT<br> <input type="checkbox" name="elementprovince" value="KANDAL" id"optPROVINCE">KANDAL<br> <input type="checkbox" name="elementprovince" value="KEP VILLE" id"optPROVINCE">KEP VILLE<br> <input type="checkbox" name="elementprovince" value="KOH KONG" id"optPROVINCE">KOH KONG<br> <input type="checkbox" name="elementprovince" value="KRATIE" id"optPROVINCE">KRATIE<br> <input type="checkbox" name="elementprovince" value="MONDOL KIRI" id"optPROVINCE">MONDOL KIRI<br> <input type="checkbox" name="elementprovince" value="ODORMEANCHEY" id"optPROVINCE">ODORMEANCHEY<br> <input type="checkbox" name="elementprovince" value="PAILIN" id"optPROVINCE">PAILIN<br> <input type="checkbox" name="elementprovince" value="PREAH VIHEAR" id"optPROVINCE">PREAH VIHEAR<br> <input type="checkbox" name="elementprovince" value="PREY VENG" id"optPROVINCE">PREY VENG<br> <input type="checkbox" name="elementprovince" value="PURSAT" id"optPROVINCE">PURSAT<br> <input type="checkbox" name="elementprovince" value="RATTANAKIRI" id"optPROVINCE">RATTANAKIRI<br> <input type="checkbox" name="elementprovince" value="SIEM REAP" id"optPROVINCE">SIEM REAP<br> <input type="checkbox" name="elementprovince" value="SIHANOUK VILLE" id"optPROVINCE">SIHANOUK VILLE<br> <input type="checkbox" name="elementprovince" value="STUNG TRENG" id"optPROVINCE">STUNG TRENG<br> <input type="checkbox" name="elementprovince" value="SVAY RIENG" id"optPROVINCE">SVAY RIENG<br> <input type="checkbox" name="elementprovince" value="TAKEO" id="optPROVINCE">TAKEO<br><% *end* %> In this case i can search by each item or all item in form. I hope that all member in rubyonrails-talk will help me to solve this problem for me. thank in advance! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---