veronika
2009-Dec-28 13:49 UTC
How to get parameters to controller from view using <input tag?
Hello! I''m everywhere searching the answer for my question. How to get
parameters to controller from view using <input tag. But I want to do
this without db. I have the code:
class TranslateController < ApplicationController
def start
@time = Time.now
end
def result
@rez = params[:name]
end
end
<html>
<head>
<title> Translate numbers from 10 to 16 system </title>
</head>
<h1> Type your number and press link </h1>
<p> Time is <%= @time %> </p>
<form action="result" name="post"
method="post"/>
<input type="image" src="c:\Users\Vero\My Documents\Aptana
Studio
Workspace\Lab_8\public\images\rails.png" align="top">
<input type="text" align="left"
value="0x">
</form>
<p> <%= link_to "Result", :action => "result"
%> </p>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Translate numbers from 10 to 16 system </title>
</head>
<body>
<h1> It''s result of your translation </h1>
<h2> <%= @rez %></h2>
<p> Back to <%= link_to "1 st page", :action =>
"start"%> </p>
</body>
</html>
I''m new in Ruby. ( please, help with all it
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2009-Dec-28 16:39 UTC
Re: How to get parameters to controller from view using <input tag?
On Dec 28, 2:49 pm, veronika <vero...-JGs/UdohzUI@public.gmane.org> wrote:> Hello! I''m everywhere searching the answer for my question. How to get > parameters to controller from view using <input tag. But I want to do > this without db. I have the code:Use the form helpers (text_field_tag etc. The rails guide on forms has examples: http://guides.rubyonrails.org/form_helpers.html ) Fred> > class TranslateController < ApplicationController > def start > @time = Time.now > end > > def result > @rez = params[:name] > end > end > > <html> > <head> > <title> Translate numbers from 10 to 16 system </title> > </head> > <h1> Type your number and press link </h1> > <p> Time is <%= @time %> </p> > <form action="result" name="post" method="post"/> > <input type="image" src="c:\Users\Vero\My Documents\Aptana Studio > Workspace\Lab_8\public\images\rails.png" align="top"> > <input type="text" align="left" value="0x"> > </form> > <p> <%= link_to "Result", :action => "result" %> </p> > </html> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > <title> Translate numbers from 10 to 16 system </title> > </head> > <body> > <h1> It''s result of your translation </h1> > <h2> <%= @rez %></h2> > <p> Back to <%= link_to "1 st page", :action => "start"%> </p> > </body> > </html> > > I''m new in Ruby. ( please, help with all it-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
veronika
2009-Dec-29 12:38 UTC
Re: How to get parameters to controller from view using <input tag?
Thanks!!! I found interesting site: http://www.codeweblog.com/ruby-on-rails-and-to-use-action-web-service-to-create-web-services/ I try to do my work the same path, but get error: "wrong number of arguments (1 for 0)". I would like to know: can I do the same without Web-client (example)? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.