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.
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>
<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.