Forum: Ruby on Rails how to make two forms on the same page???

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jon (Guest)
on 2006-03-09 22:15
I can get the forms to be displayed, but i want to have only one
"create" button. i've tried everything i can think of...
Josh on Rails (Guest)
on 2006-03-09 22:42
(Received via mailing list)
On 3/9/06, jon <removed_email_address@domain.invalid> wrote:
>
> I can get the forms to be displayed, but i want to have only one "create"
> button. i've tried everything i can think of...
>

*If* I understand you, you want to have something like...

[form1]
[field1]
[field2]
[end_form1]
[form2]
[field3]
[submit]
[end_form2]

...and have the submit button submit both form1 and form2?

That's not something regulation HTML is capable of*. Is there a reason
you
can't you just combine the forms?


* You /could/, *technically*, do this in JavaScript with onsubmit(), but
it's error-prone and - at best - only works with JavaScript-enabled
browsers.
John B. (Guest)
on 2006-04-05 19:33
How do you have 2 forms on the same page with 2 diiferent submit tags?
Alan F. (Guest)
on 2006-04-05 19:34
John B. wrote:
> How do you have 2 forms on the same page with 2 diiferent submit tags?

Can you post the rhtml you're currently trying ?

Alan
John B. (Guest)
on 2006-04-05 19:37
Well they cross paths when i render a partial but when they are
currently on the same page they have the following code:

<b>Leave a Reply</b>
<%= form_tag :action => "comment", :id => @post %>
<%= render :partial => 'commentform' %>
<p id=commentindent><%= submit_tag "Comment!" %></p>

and

<%= form_tag :action => 'search' %>
  <p align =center><%= text_field_tag 'search' , params[:search], "size"
=>"20" %>
  <%= submit_tag 'Search'  %></p>
<%= end_form_tag %>

The 1st form Leave a reply gets called regardless of which submit button
i click.
Alan F. (Guest)
on 2006-04-05 19:38
John B. wrote:
> Well they cross paths when i render a partial but when they are
> currently on the same page they have the following code:
>
> <b>Leave a Reply</b>
> <%= form_tag :action => "comment", :id => @post %>
> <%= render :partial => 'commentform' %>
> <p id=commentindent><%= submit_tag "Comment!" %></p>
>
> and
>
> <%= form_tag :action => 'search' %>
>   <p align =center><%= text_field_tag 'search' , params[:search], "size"
> =>"20" %>
>   <%= submit_tag 'Search'  %></p>
> <%= end_form_tag %>
>
> The 1st form Leave a reply gets called regardless of which submit button
> i click.


There's no end_form_tag after the first form ?

Alan
Rimantas L. (Guest)
on 2006-04-05 19:41
(Received via mailing list)
<...>
>   <%= submit_tag 'Search'  %></p>
> <%= end_form_tag %>
>
> The 1st form Leave a reply gets called regardless of which submit button
> i click.


Where's your end_form_tag for the first form?

Regards,
Rimantas
--
http://rimantas.com/
John B. (Guest)
on 2006-04-05 19:45
problem solved!

I'm having 1 of those days, time to finish up for the day i think

Thanks
This topic is locked and can not be replied to.