Cutting Peter
2005-Feb-15 17:28 UTC
Is this correct: <form action="../send_email/<%= @user.id %>" method="post">
Hi
While adding functionality to my noddy program I found I had to stick
the user.id on the end of the form action URL to keep things working. I
want to have the user.id on the end of the URL but I suspect that I am
hacking it and that there is a better way.
Below is the whole email_user.rhtml file
<html>
<body>
<form action="../send_email/<%= @user.id %>"
method="post">
<p>
<br><b> Name:</b> <%= @user.name %>
</p>
<textarea cols="40" id="message"
name="message"
rows="5" wrap="virtual">
<%= @message %></textarea>
<input type="submit" value="Send">
</form>
<%= link_to ''Back'', :action => ''list''
%>
</body>
</html>
Bonus question - anyone know how to put the cursor in the textarea so
that the user can start typing immediately.
Thanks
Peter
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
Juraci Krohling Costa
2005-Feb-15 17:36 UTC
Re: Is this correct: <form action="../send_email/<%= @user.id %>" method="post">
Hi, <%= start_form_tag :action=>"send_mail", :id=>@user.id %> ..... <%= end_form_tag %> =) On Tue, 15 Feb 2005 18:28:34 +0100, Cutting Peter <Peter.Cutting-CwpgxV1jTAxWk0Htik3J/w@public.gmane.org> wrote:> > > > Hi > > While adding functionality to my noddy program I found I had to stick the > user.id on the end of the form action URL to keep things working. I want to > have the user.id on the end of the URL but I suspect that I am hacking it > and that there is a better way. > > Below is the whole email_user.rhtml file > > <html> > > <body> > > <form action="../send_email/<%= @user.id %>" method="post"> > > <p> > > <br><b> Name:</b> <%= @user.name %> > > </p> > > <textarea cols="40" id="message" > > name="message" > > rows="5" wrap="virtual"> > > <%= @message %></textarea> > > <input type="submit" value="Send"> > > </form> > > <%= link_to ''Back'', :action => ''list'' %> > > </body> > > </html> > > > > Bonus question - anyone know how to put the cursor in the textarea so that > the user can start typing immediately. > > Thanks > > Peter > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- juraci krohling costa
Belorion
2005-Feb-15 17:37 UTC
Re: Is this correct: <form action="../send_email/<%= @user.id %>" method="post">
On Tue, 15 Feb 2005 18:28:34 +0100, Cutting Peter <Peter.Cutting-CwpgxV1jTAxWk0Htik3J/w@public.gmane.org> wrote:> > > > Hi > > While adding functionality to my noddy program I found I had to stick the > user.id on the end of the form action URL to keep things working. I want to > have the user.id on the end of the URL but I suspect that I am hacking it > and that there is a better way. >Maybe try: <input type=hidden name=id value=<%= @user.id %> > But I don''t see anything wrong with the way you are doing it. And as for the autofocus, you can do that with javascript (you''ll need to add the name= attribute to your form): <body onLoad="document.formname.message.focus()">
Belorion
2005-Feb-15 17:39 UTC
Re: Is this correct: <form action="../send_email/<%= @user.id %>" method="post">
> <%= start_form_tag :action=>"send_mail", :id=>@user.id %> > ..... > <%= end_form_tag %>Hey, that''s pretty nifty. Wasn''t aware of that helper!
Jarkko Laine
2005-Feb-15 17:44 UTC
Re: Is this correct: <form action="../send_email/<%= @user.id %>" method="post">
On 15.2.2005, at 19:28, Cutting Peter wrote:> Bonus question - anyone know how to put the cursor in the textarea so > that the user can start typing immediately.This is an alternative to Belorion''s method. This should test that the browser can really handle the javascript. Beware, tho, I wrote it from the top of my head. function setfocus( targetId ) { if (document.getElementById) { target = document.getElementById( targetId ); target.focus(); } } <body onload="setfocus(''yourareaid'');"> <textarea id="yourareaid" name="yourareaid" ...>> > Thanks > > Peter > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails