nickh
March 18, 2009, 9:06pm
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
nickh
March 18, 2009, 11:11pm
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 %>
<[email protected] do |stock|%>
#Create set of checkbox and use stock_id as id
<%end%>
<%end%>
On Mar 18, 1:06 pm, Nick H. [email protected]
nickh
March 18, 2009, 11:22pm
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 %>
<[email protected] do |stock|%>
#Create set of checkbox and use stock_id as id
<%end%>
<%end%>
On Mar 18, 1:06�pm, Nick H. [email protected]
Thanks for quick response
How exactly do you do a checkbox with an id?
<%= form.check_box :stock_id %>?
nickh
March 18, 2009, 11:29pm
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
nickh
March 19, 2009, 2:46am
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!