I have this form partial:
.row
.span6
.well
%h2 Sign in
= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'form-vertical' }) do |f|
= f.input :email, :autofocus => true, :wrapper => :bootstrap_placeholder
= f.input :password, :wrapper => :bootstrap_placeholder
= f.input :remember_me, :as => :boolean if devise_mapping.rememberable?
= f.button :submit, "Sign in", :class => 'btn-primary'
= render "devise/shared/links"
.span6
.well
%h2 Sign up
= simple_form_for(resource, :as => resource_name, :url => regi stration_path(resource_name), :html => {:class => 'form-vertical' }) do |f|
= f.error_notification
= display_base_errors resource
= f.input :name, :autofocus => true
= f.input :email, :required => true
= f.input :password, :required => true
= f.input :password_confirmation, :required => true
= f.button :submit, 'Sign up', :class => 'btn-primary'
= render "devise/shared/links"
and its working ok but the problem comes with validation, when i want to register a user without entering any data… shows the error message but it also higlights the username and password field of the sign in form.. is there a way of avoiding this validation mixups?
resourceis the same on both forms, so it is normal if the errors display on both. To prevent that, you have to separate the resources you use. Try something like this.