Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client side validations with Devise

I am trying to use the client_side_validations gem with Devise to validate devise registrations form.

Validations work fine with everything else just not the Devise generated form.

I added the relevant :validate => true but the validations only work when I hit submit not on tab like they do on every other form.

<h2>Sign up</h2>
<hr />

<%= form_for(resource, :validate => true, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
  <%= devise_error_messages! %>

  <div><%= f.label :username %>
  <%= f.text_field :username %></div>

  <div><%= f.label :email %>
  <%= f.email_field :email %></div>

  <div><%= f.label :password %>
  <%= f.password_field :password %></div>

  <div><%= f.label :password_confirmation %>
  <%= f.password_field :password_confirmation %></div>

  <br />

  <div><%= f.submit "Sign up", :class => "btn btn-primary btn-large" %></div>
<% end %>

<%= render "links" %>
like image 241
Akshay Kumar Avatar asked Mar 29 '26 22:03

Akshay Kumar


1 Answers

Argc, argv! I am using Rails 3.2.1, the latest release of the gem is incompatible with 3.2 hence the nightmare. Using 3.2.0.beta.2 fixes the problems. Thanks!

like image 95
Akshay Kumar Avatar answered Apr 02 '26 05:04

Akshay Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!