Multiple form_tag on page

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














user name : <%= text_field(:user, :username) %>
password : <%= password_field(:user, :password) %>
<%= submit_tag(‘Login’) %> | <%= link_to(‘new
venue’, :controller => ‘venue’, :action => ‘new’) %>

<%= form_tag %>
<h2>Commenter Login</h2>

<%= form_tag('send_feedback', :controller => 'public', :action =>

‘send_fedback’) %>
<%= error_messages_for ‘temp’ %>










venue code : <%= text_field(:comments, :restaurant_id) %>
<%= submit_tag(‘Feedback’) %>

<%= form_tag %>

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…

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

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, “[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs