Add id to form_tag?

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 C.man

Jeff C.man 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 C.man

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

Hope this helps

p.s. Why GET and not POST?

Chris T wrote:

Jeff C.man 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 C.man

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

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