Topic: Multiple forms on one page?

I'm trying to use multiple forms on one page, using scriptaculous to hide the forms when not in use.  Every time I try to save one of the forms it fails because it submits all the empty data from the other forms.  Is it possible to have multiple forms on one page?  Thanks

Re: Multiple forms on one page?

Multiple forms on one page is certainly possible. Are you currently creating multiple start/end form tags? Would you mind posting the code you have now?

Last edited by ryanb (2006-11-02 20:24:04)

Railscasts - Free Ruby on Rails Screencasts

Re: Multiple forms on one page?

Wow I wasn't thinking.  I had the form start and end tags as the same thing.  I changed them to different things and they work great.  Thanks

Re: Multiple forms on one page?

Question.

Can i have that second form is inside first.

## example
<%= start_form_tag :action => 'multiple_users_actions' %>

  <%= form_remote_tag :url => { :action => 'add_parent', :id => @student.id }

    <%= submit_tag "Add" %>

  <%= end_form_tag %>

<%= end_form_tag %>


If i press add, then it does submit to action 'multiple_users_action'.
form_remote is rendered with rjs. If i look source with FireBug, there isnt even second form tag.

Re: Multiple forms on one page?

Nested forms aren't supported by HTML. Instead I suggest link_to_remote for the add button.

Railscasts - Free Ruby on Rails Screencasts