Hi All, I have done a validation check in my form to check for email,username and firstname...here is the code
class User < ActiveRecord::Base
validates_presence_of :email, :firstname, :username
validates_format_of :email,
:with => /[-!#$&'*+\/=?`{|}~.\w]+@[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])*(\.[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])*)+$/,
:message => ' appears to be invalid'
end
And in my view part is looking like this
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
</div>
The issue is wenever validation fails, all the errors are listed above the form....I want the errors to be displayed corresponding to the textboxes.....how do i do that