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’) %>


<%= text_field_tag ‘s’%>
Szukaj

<%= form_tag %>

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

<%= form_tag :controller => ‘kontakty’, :action => ‘new’, :method =>
‘post’ %>

Imiê:
<%= text_field ‘contact’, ‘name’, :class => ‘s’ %>


Nazwisko:
<%= text_field ‘contact’, ‘surname’, :class => ‘s’ %>


Data urodzenia:
<%= calendar_date_select_tag “contact[birth]”,
“nil”, :year_range => 1900…2008 %>



<%= 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:

On 8 Mar 2008, at 22:50, abusiek wrote:

  <!-- <input id="s" type="text" name="s" value="" /> -->

Imiê: 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: )

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