Hi.. new to the whole Rails thing so this may sound aweful strange but I cannot find any documentation supporting or correcting what I am trying to do.. I would like to have 2 separate form_tag''s displayed on a single page. They both have varying function so my thinking is 2 separate form_tag''s (am I wrong). My problem is when the page renders it only renders 1 form but housing the varu=ious components of each form_tag (eg. input boxes, submit button etc). There are 2 submit buttons for each of the functions Im wanting to perfom but because they are caught up under the one form_tag, it doesnt matter which one I press, only the one action is ever performed.. As mentioned, very new so not sure what I should be doing.. <%= form_tag(:controller => ''public'', :action => ''send_login'') %> <%= error_messages_for ''user'' %> <table> <tr> <th>user name :</th> <td><%= text_field(:user, :username) %></td> </tr> <tr> <th>password :</th> <td><%= password_field(:user, :password) %></td> </tr> <tr> <th></th> <td><%= submit_tag(''Login'') %> | <%= link_to(''new venue'', :controller => ''venue'', :action => ''new'') %></td> </tr> </table> <%= form_tag %> <!-- User feedback section shown below --> <h2>Commenter Login</h2> <%= form_tag(''send_feedback'', :controller => ''public'', :action => ''send_fedback'') %> <%= error_messages_for ''temp'' %> <table> <tr> <th>venue code :</th> <td><%= text_field(:comments, :restaurant_id) %></td> </tr> <tr> <th></th> <td><%= submit_tag(''Feedback'') %></td> </tr> </table> <%= form_tag %> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I should have added.... Using Rails 2.0.2. I know this works with previous versions with the start_form_tag and end_form_tag as I have seen code that does this. However, with 2.0+, this seems to have gone the way of the dodo and I cannot figure out a way of doing it... And clearly these form_tag''s are NOT nested as I know HTML does not support this. My gut feel is this should be something simple and I am just missing something very basic... On Jan 22, 10:49 am, toshach <tosh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi.. new to the whole Rails thing so this may sound aweful strange > but I cannot find any documentation supporting or correcting what I am > trying to do.. > > I would like to have 2 separate form_tag''s displayed on a single > page. They both have varying function so my thinking is 2 separate > form_tag''s (am I wrong). > > My problem is when the page renders it only renders 1 form but housing > the varu=ious components of each form_tag (eg. input boxes, submit > button etc). There are 2 submit buttons for each of the functions Im > wanting to perfom but because they are caught up under the one > form_tag, it doesnt matter which one I press, only the one action is > ever performed.. > > As mentioned, very new so not sure what I should be doing.. > > <%= form_tag(:controller => ''public'', :action => ''send_login'') %> > <%= error_messages_for ''user'' %> > <table> > <tr> > <th>user name :</th> > <td><%= text_field(:user, :username) %></td> > </tr> > <tr> > <th>password :</th> > <td><%= password_field(:user, :password) %></td> > </tr> > <tr> > <th></th> > <td><%= submit_tag(''Login'') %> | <%= link_to(''new > venue'', :controller => ''venue'', :action => ''new'') %></td> > </tr> > </table> > <%= form_tag %> > > <!-- User feedback section shown below --> > <h2>Commenter Login</h2> > > <%= form_tag(''send_feedback'', :controller => ''public'', :action => > ''send_fedback'') %> > <%= error_messages_for ''temp'' %> > <table> > <tr> > <th>venue code :</th> > <td><%= text_field(:comments, :restaurant_id) %></td> > </tr> > <tr> > <th></th> > <td><%= submit_tag(''Feedback'') %></td> > </tr> > </table> > <%= form_tag %>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-22 00:44 UTC
Re: multiple form_tag on page
2 things: 1. You need to ''end'' the form_tag. 2. Blocks (that is, when there''s a ''do'' and an ''end'') no longer have "=" in the Erb tags. In other words: <% form_tag do %> ... <% end %> Always check out http://api.rubyonrails.com and search for the method you''re having trouble with On Jan 21, 6:23 pm, toshach <tosh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I should have added.... > > Using Rails 2.0.2. I know this works with previous versions with the > start_form_tag and end_form_tag as I have seen code that does this. > However, with 2.0+, this seems to have gone the way of the dodo and I > cannot figure out a way of doing it... > > And clearly these form_tag''s are NOT nested as I know HTML does not > support this. My gut feel is this should be something simple and I am > just missing something very basic... > > On Jan 22, 10:49 am, toshach <tosh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi.. new to the whole Rails thing so this may sound aweful strange > > but I cannot find any documentation supporting or correcting what I am > > trying to do.. > > > I would like to have 2 separate form_tag''s displayed on a single > > page. They both have varying function so my thinking is 2 separate > > form_tag''s (am I wrong). > > > My problem is when the page renders it only renders 1 form but housing > > the varu=ious components of each form_tag (eg. input boxes, submit > > button etc). There are 2 submit buttons for each of the functions Im > > wanting to perfom but because they are caught up under the one > > form_tag, it doesnt matter which one I press, only the one action is > > ever performed.. > > > As mentioned, very new so not sure what I should be doing.. > > > <%= form_tag(:controller => ''public'', :action => ''send_login'') %> > > <%= error_messages_for ''user'' %> > > <table> > > <tr> > > <th>user name :</th> > > <td><%= text_field(:user, :username) %></td> > > </tr> > > <tr> > > <th>password :</th> > > <td><%= password_field(:user, :password) %></td> > > </tr> > > <tr> > > <th></th> > > <td><%= submit_tag(''Login'') %> | <%= link_to(''new > > venue'', :controller => ''venue'', :action => ''new'') %></td> > > </tr> > > </table> > > <%= form_tag %> > > > <!-- User feedback section shown below --> > > <h2>Commenter Login</h2> > > > <%= form_tag(''send_feedback'', :controller => ''public'', :action => > > ''send_fedback'') %> > > <%= error_messages_for ''temp'' %> > > <table> > > <tr> > > <th>venue code :</th> > > <td><%= text_field(:comments, :restaurant_id) %></td> > > </tr> > > <tr> > > <th></th> > > <td><%= submit_tag(''Feedback'') %></td> > > </tr> > > </table> > > <%= form_tag %>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ahh - that was so simple - thank you very much.. I did look through the api documentation but admittedly was manically skimming it instead of taking it in and must have overlooked that pesky little ''='' sign On Jan 22, 11:44 am, "stephen.ce...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <stephen.ce...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 2 things: > > 1. You need to ''end'' the form_tag. > 2. Blocks (that is, when there''s a ''do'' and an ''end'') no longer have > "=" in the Erb tags. > > In other words: > > <% form_tag do %> > ... > <% end %> > > Always check outhttp://api.rubyonrails.comand search for the method > you''re having trouble with > > On Jan 21, 6:23 pm, toshach <tosh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I should have added.... > > > Using Rails 2.0.2. I know this works with previous versions with the > > start_form_tag and end_form_tag as I have seen code that does this. > > However, with 2.0+, this seems to have gone the way of the dodo and I > > cannot figure out a way of doing it... > > > And clearly these form_tag''s are NOT nested as I know HTML does not > > support this. My gut feel is this should be something simple and I am > > just missing something very basic... > > > On Jan 22, 10:49 am, toshach <tosh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi.. new to the whole Rails thing so this may sound aweful strange > > > but I cannot find any documentation supporting or correcting what I am > > > trying to do.. > > > > I would like to have 2 separate form_tag''s displayed on a single > > > page. They both have varying function so my thinking is 2 separate > > > form_tag''s (am I wrong). > > > > My problem is when the page renders it only renders 1 form but housing > > > the varu=ious components of each form_tag (eg. input boxes, submit > > > button etc). There are 2 submit buttons for each of the functions Im > > > wanting to perfom but because they are caught up under the one > > > form_tag, it doesnt matter which one I press, only the one action is > > > ever performed.. > > > > As mentioned, very new so not sure what I should be doing.. > > > > <%= form_tag(:controller => ''public'', :action => ''send_login'') %> > > > <%= error_messages_for ''user'' %> > > > <table> > > > <tr> > > > <th>user name :</th> > > > <td><%= text_field(:user, :username) %></td> > > > </tr> > > > <tr> > > > <th>password :</th> > > > <td><%= password_field(:user, :password) %></td> > > > </tr> > > > <tr> > > > <th></th> > > > <td><%= submit_tag(''Login'') %> | <%= link_to(''new > > > venue'', :controller => ''venue'', :action => ''new'') %></td> > > > </tr> > > > </table> > > > <%= form_tag %> > > > > <!-- User feedback section shown below --> > > > <h2>Commenter Login</h2> > > > > <%= form_tag(''send_feedback'', :controller => ''public'', :action => > > > ''send_fedback'') %> > > > <%= error_messages_for ''temp'' %> > > > <table> > > > <tr> > > > <th>venue code :</th> > > > <td><%= text_field(:comments, :restaurant_id) %></td> > > > </tr> > > > <tr> > > > <th></th> > > > <td><%= submit_tag(''Feedback'') %></td> > > > </tr> > > > </table> > > > <%= form_tag %>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---