Reputation: 2169
In my rails app I'm using simple_form. I need to get the error messages in the input field instead of it being displayed on the side, like the image shown below.
How can I do this?
Upvotes: 1
Views: 144
Reputation: 483
You could use CSS to move the error field into the area of the input field.
example.html.erb
<div class="row">
<%= f.text_field :email, class: "email" %>
<span class="error">
</div>
example.css
.row .error {
margin: -20px;
}
example: http://codepen.io/phelpsiv/pen/ZOaomq
Upvotes: 1