<%= simple_form_for (@category), :validate => true do |f| %>
<%= f.error_messages %>
<ol class="formList">
<%= f.hidden_field :user_id, :value => current_user.id %>
<%= f.input :category, :size =>20, :title => "Enter Category Name" %>
<%= f.submit %><div class="load_preview_customer"><%= f.submit "preview", :style => 'width:100px;', data: {:disable_with=>"loading preview..."} %></div>
</ol>
<% end %>
the validation working only when i click on the submit button not when tab out of the field, I have also generated the rails.validation file under the initializer directory, and added the assets for simple form in application.js also