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 )