Adding "id='xyz' " to a form_tag

I am using the form_tag_helper to create a form, but I want to give it
an ID so I can style the elements within the form. I currently have
the following:

        <% form_tag :controller => 'my_controller', :action =>
'my_action' do %>
          <input class="actionButton" type="submit" value="Submit" />
        <% end %>

I tried this:

        <% form_tag :id => 'xyz', :controller =>
'my_controller', :action => 'my_action' do %>
          <input class="actionButton" type="submit" value="Submit" />
        <% end %>

This compiles and runs ok with no errors, but it treats the ID= as a
parameter for my URL - not what I want. Is there a way to use
form_tag to generate HTML similar to this:

          <form id="xyz" action="/my_directory/my_action"
method="post">

Thanks,

Steve J.

<% form_tag {:controller => “…”}, {:id => “xyz”} %>
Try it?

Hi Steve!

     Try this <%= form_tag :action => 'my_action', :id =>'xyz' %> and
I think this manual will be helpful to
you.http://blog.invisible.ch/files/rails-reference-1.1.html#htmlforms .

enjoy ! have a great day.

cheers,
shankar.

    I am using the form_tag_helper to create a form, but I want to give it
    an ID so I can style the elements within the form. I currently have
    the following:

Style things with classes unless you must use IDs. I can't think of a reason.

Rails is so flexible that, before you know it, you will be cloning this form and en-partialling it into your page more than once, and IDs must be unique to their document...

I did try with class= instead of id=, but I get the exact same result

Look at the Api. You need to supply two hashed rather than one. The
second has
HTML options. The first is the URL

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

That won't work.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Steve, Have you tried this
url(http://blog.invisible.ch/files/rails-reference-1.1.html#htmlforms .
) ?

shankar.

That's not true. Ids are perfectly valid.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Thanks everyone for all the help . . .

When I tried it like this, I got a compile error:
<% form_tag ( {:controller => 'my_controller', :action =>
'my_action' }, {:id => 'xyz'}) do %>

When I removed the second set of braces { }, like this, it works!!!

<% form_tag ( {:controller => 'my_controller', :action =>
'my_action' }, :id => 'xyz') do %>

Thanks again, I appreciate all the suggestions!

I just added the extra braces back in so I could see the error again,
but now it does not complain - I must have had something extra or
something missing. So I guess it works both ways.