Hi all, What is the correct syntax to add an id attribute to a form tag with the "form_tag" helper? I''ve tried start_form_tag({:controller => ''houses'', :action => ''find''}, {:method => :get, :id => ''search''}) start_form_tag({:controller => ''houses'', :action => ''find''}, :method => :get, :id => ''search'') And other variations, but so far it doesn''t give the form the attribute. Can it be done? Thanks, Jeff Coleman -- Posted via http://www.ruby-forum.com/.
Jeff Coleman wrote:> Hi all, > > What is the correct syntax to add an id attribute to a form tag with the > "form_tag" helper? > > I''ve tried > > start_form_tag({:controller => ''houses'', :action => ''find''}, {:method => > :get, :id => ''search''}) > > start_form_tag({:controller => ''houses'', :action => ''find''}, :method => > :get, :id => ''search'') > > And other variations, but so far it doesn''t give the form the attribute. > Can it be done? > > Thanks, > Jeff Coleman > >Not sure if I''m understanding what you''re trying here but try: start_form_tag({:controller => ''houses'', :action => ''find'', :id =>''search''}, {:method => :get}) generates <form action="/houses/find/search" method="get"> Hope this helps p.s. Why GET and not POST?
Chris T wrote:> Jeff Coleman wrote: >> start_form_tag({:controller => ''houses'', :action => ''find''}, :method => >> :get, :id => ''search'') >> >> And other variations, but so far it doesn''t give the form the attribute. >> Can it be done? >> >> Thanks, >> Jeff Coleman >> >> > Not sure if I''m understanding what you''re trying here but try: > > start_form_tag({:controller => ''houses'', :action => ''find'', :id > =>''search''}, {:method => :get}) > generates > <form action="/houses/find/search" method="get"> > Hope this helps > > p.s. Why GET and not POST?Thanks, Chris. I was making a silly mistake--when I checked in my code, I was looking at the wrong form tag, and thinking the "id" tag wasn''t working. "Get"''s used here because it''s a non-destructive search operation and I want people to be able to bookmark or go back to the results page. Jeff -- Posted via http://www.ruby-forum.com/.