two form_tag's

Hi!

I'm new with ruby on rails and I've faced such a problem:

In layout I have one form:

<%= form_tag ({:controller => 'kontakty', :action =>
'search'}, :method => 'get') %>
      <fieldset>
      <!-- <input id="s" type="text" name="s" value="" /> -->
                            <%= text_field_tag 's'%>
                            <button id="x" value="Szukaj"
onclick="this.form.submit();">Szukaj</button>
      </fieldset>
<%= form_tag %>

And in view for action 'Create' (where you can add new record):

<%= form_tag :controller => 'kontakty', :action => 'new', :method =>
'post' %>
    <p><label for="contact_name">Imię</label>:
        <%= text_field 'contact', 'name', :class => 's' %></p>
    <p><label for="contact_surname">Nazwisko</label>:
        <%= text_field 'contact', 'surname', :class => 's' %></p>
     <p><label for="contact_birth">Data urodzenia</label>:
        <%= calendar_date_select_tag "contact[birth]",
"nil", :year_range => 1900..2008 %>
       </p>
    <input class="x" type="submit" value="Dodaj" />
<%= form_tag %>

When I'm submitting the second form all parameters are sent two the
first one and action from the firts one is executed.

Any ideas why? (and sorry for my poor english :frowning: )

sorry for stupid question, I was reading wrong tutorial :wink:

It's probably confused by the way you're openening lots of form tags and not closing them (have you looked at the generated html :slight_smile: )

What you should be doing with form tag is
<% form_tag(...) do %>

<% end %>

With older versions of rails it was different, but even then at the end of the form you needed <%= end_form_tag %> at the end.
Fred