Search Results into new table


#1

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


#2

#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 %>
<removed_email_address@domain.invalid do |stock|%>
#Create set of checkbox and use stock_id as id
<%end%>
<%end%>

On Mar 18, 1:06 pm, Nick H. removed_email_address@domain.invalid


#3

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 %>
<removed_email_address@domain.invalid do |stock|%>
#Create set of checkbox and use stock_id as id
<%end%>
<%end%>

On Mar 18, 1:06�pm, Nick H. removed_email_address@domain.invalid

Thanks for quick response

How exactly do you do a checkbox with an id?

<%= form.check_box :stock_id %>?


#4

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


#5

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|%>

ALL

PHNOM PENH

BANTEAY MEANCHEY

BATTAMBANG

KAMPONG CHAM

KAMPONG CHHNANG

KAMPONG SPEU

KAMPONG THOM

KAMPOT

KANDAL

KEP VILLE

KOH KONG

KRATIE

MONDOL KIRI

ODORMEANCHEY

PAILIN

PREAH VIHEAR

PREY VENG

PURSAT

RATTANAKIRI

SIEM REAP

SIHANOUK VILLE

STUNG TRENG

SVAY RIENG

<input type=“checkbox” name=“elementprovince” value=“TAKEO”
id=“optPROVINCE”

TAKEO

<% 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!