Cutting Peter
2005-Feb-16 09:54 UTC
Re: Is this correct: <form action="../send_email/<%= @user.id
<%= start_form_tag :action=>"send_mail", :id=>@user.id %> Works nicely but I cant seem to "name" the form Eg <%= start_form_tag :action=>"send_mail", :name=>"formname", :id=>@user.id %> so that I can then reference it in the JS call. Doh! <body onLoad="document.formname.message.focus()"> I have tried option name, form_name and formname Peter
David Heinemeier Hansson
2005-Feb-16 10:18 UTC
Re: Re: Is this correct: <form action="../send_email/<%= @user.id
> <%= start_form_tag :action=>"send_mail", :name=>"formname", > :id=>@user.id %>The start_form_tag takes two hash parameters. One with options for the action, one for the html, so you need: <%= start_form_tag({ :action=>"send_mail", :name=>"formname" }, { :id=>@user.id }) %> -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://www.loudthinking.com/ -- Broadcasting Brain
Ben Schumacher
2005-Feb-16 10:22 UTC
Re: Re: Is this correct: <form action="../send_email/<%= @user.id
I think this is something that needs to be documented better, but
since start_form_tag takes two different hashes, it''s best to wrap
them in { } to differentiate between them.
The fix is:
<%= start_form_tag( { :action=>"send_mail" }, { :id=>@user.id
} ) %>
Note the parenthesis and the curly brackets.
(Just FYI, this was covered in an earlier thread -- in the archives at:
http://one.textdrive.com/pipermail/rails/2005-February/thread.html#2797)
Cheers,
bs.
On Wed, 16 Feb 2005 10:54:04 +0100, Cutting Peter
<Peter.Cutting-CwpgxV1jTAxWk0Htik3J/w@public.gmane.org>
wrote:> <%= start_form_tag :action=>"send_mail", :id=>@user.id
%>
>
> Works nicely but I cant seem to "name" the form
> Eg
>
> <%= start_form_tag :action=>"send_mail",
:name=>"formname",
> :id=>@user.id %>
>
> so that I can then reference it in the JS call. Doh!
>
> <body onLoad="document.formname.message.focus()">
>
> I have tried option name, form_name and formname
>
> Peter
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
Ben Schumacher
2005-Feb-16 10:23 UTC
Re: Re: Is this correct: <form action="../send_email/<%= @user.id
And of course, I can''t seem to post to this list without messing up my
copying and pasting, but it should be:
<%= start_form_tag( { :action=>"send_mail" }, { :name =>
''formname'',
:id=>@user.id } ) %>
On Wed, 16 Feb 2005 11:22:26 +0100, Ben Schumacher
<benschumacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I think this is something that needs to be documented better, but
> since start_form_tag takes two different hashes, it''s best to wrap
> them in { } to differentiate between them.
>
> The fix is:
>
> <%= start_form_tag( { :action=>"send_mail" }, {
:id=>@user.id } ) %>
>
> Note the parenthesis and the curly brackets.
>
> (Just FYI, this was covered in an earlier thread -- in the archives at:
> http://one.textdrive.com/pipermail/rails/2005-February/thread.html#2797)
>
> Cheers,
>
> bs.
>
> On Wed, 16 Feb 2005 10:54:04 +0100, Cutting Peter
> <Peter.Cutting-CwpgxV1jTAxWk0Htik3J/w@public.gmane.org> wrote:
> > <%= start_form_tag :action=>"send_mail",
:id=>@user.id %>
> >
> > Works nicely but I cant seem to "name" the form
> > Eg
> >
> > <%= start_form_tag :action=>"send_mail",
:name=>"formname",
> > :id=>@user.id %>
> >
> > so that I can then reference it in the JS call. Doh!
> >
> > <body onLoad="document.formname.message.focus()">
> >
> > I have tried option name, form_name and formname
> >
> > Peter
> >
> > _______________________________________________
> > Rails mailing list
> > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
>