I get a routing error when I try and read from a text field. The
error says:
ROUTING ERROR
no route found to match "/\\look\\at" with {:method=>:get}
Heres the code Im using to read data from a text field:
input.html:
<html>
<head>
<title>Text Fields</title>
</head>
<body>
<h1>Textfields</h1>
<br>
<form action = "\look\at">
Please enter your name.
<br>
<input type = "text" name="text1">
<br>
<br>
<input type="submit"/>
</form>
</body>
</html>
look_controller.rb:
class LookController < ApplicationController
def at
@data = params[:text1]
end
end
at.rhtml:
<html>
<head>
<title>Reading from Text Fields</title>
</head>
<body>
<h1>Reading from Textfields</h1>
<br>
Your name is <%= @data %>
<br>
</body>
</html>
Does anyone know why I keep getting this error. This seems like a
simple thing but I cant figure it out and its impeding my ruby
learning process.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
TTDaVeTT wrote:> I get a routing error when I try and read from a text field. The > error says: > > ROUTING ERROR > no route found to match "/\\look\\at" with {:method=>:get} > > Heres the code Im using to read data from a text field: > input.html: > <html> > <head> > <title>Text Fields</title> > </head> > <body> > <h1>Textfields</h1> > <br> > > <form action = "\look\at"> > Please enter your name. > <br> > <input type = "text" name="text1"> > <br> > <br> > <input type="submit"/> > </form> > </body> > </html> > > look_controller.rb: > class LookController < ApplicationController > def at > @data = params[:text1] > end > end > > at.rhtml: > <html> > <head> > <title>Reading from Text Fields</title> > </head> > <body> > <h1>Reading from Textfields</h1> > <br> > Your name is <%= @data %> > <br> > </body> > </html> > > Does anyone know why I keep getting this error. This seems like a > simple thing but I cant figure it out and its impeding my ruby > learning process.Don''t use backslashes "\" in your URL paths. Use forward slashes "/" instead. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---