Issue
In the picture you can see 2Buttons: screenshot
I want the user to just type in the email and password and accept it by pressing return.
Is there an opportunity to set this up?
I know that there is a option in C#, but I forgot how it's called. (Standard-Button?)
There are 2 input-texts and 2buttons (Login-Form / Register) eMail - Password - Login-Btn and or-Register-btn. The user types in his email and password. After that he press "return" to accept and he is logged in. How is the options called that the login-btn is the ... first button to choose by pressing "return"?***
That's what I am using:
- Ruby on Rails 4
- HTML
- HTML.ERB
- Bootstrap 3
Solution
You may have an answer, but to help you understand it, you need to remember Rails renders everything as HTML on the browser-side; so every element you want to display has to be some sort of HTML object
If you want to show a button in Rails, there are a number of ways to do it:
This creates a simple form which points to a URL. The form has a button
element inside, making it look like a pure HTML button to the user:
<%= button_to "New", action: "new" %>
# => "<form method="post" action="/controller/new" class="button_to">
# <div><input value="New" type="submit" /></div>
# </form>"
For your specific issue, I think you'll benefit from f.submit
, which basically adds a submit button to your form:
<%= form_for @var do |f| %>
<%= f.submit "Register" %>
<% end %>
If you'd like to style this, you'll be able to apply classes to the button directly:
<%= f.submit "Text", class: "class" %>
Answered By - Richard Peck
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.