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 :( ) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sorry for stupid question, I was reading wrong tutorial ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Mar 2008, at 22:50, abusiek wrote:> > 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 :( )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 :-) ) 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---