This is in my .erb file:
<form method="post" action="/login" id="login" enctype="text/plain">
Username: <input type="text" id="username" placeholder="Enter username here">
Password: <input type="password" id="password" placeholder="Enter password here">
<%= @error (will display if wrong) %>
<input TYPE="button" VALUE="Submit" />
</form>
And this is in my .rb file:
post '/login' do
#connects to database
if #connection successful
# does something
else
#do something else
end
end
However, when I try to click my "Submit" button to log in, nothing happens. Originally I was connecting to a database and checking for info, but after that I was just trying to set an error message to be a certain value, and even that won't work. I know this is something silly I'm missing. What piece is not there? (Using Postgres with Eruby, and it's running on Heroku.)
You’re using the
buttontype ofinput, for which the docs say:This type of
inputcontrol is usually used when you want to attach some javascript behaviour to a button. For submitting a form, you wanttype=submit:So in your Erb file, change this line:
to