2
votes

Client side validations are working perfectly on my other simple_forms. Code I am using in other forms is:

 <%= simple_form_for @group, :validate => true , :html => { :class => 'form-horizontal' } do |f| %>

In Case of devise sign up form, Code is:

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

I even tried:

  <%= simple_form_for(@user, :validate => true, :url => registration_path(resource_name)) do |f| %>

But its not working :(

My Gem file is:

gem 'simple_form'
gem "client_side_validations"
gem 'client_side_validations-simple_form'

Versions:

 client_side_validations (3.2.0)
   client_side_validations-simple_form (2.0.0)
    client_side_validations (~> 3.2.0)
    simple_form (~> 2.0.3)

Any suggestions?

1
@bcardarella Any suggestions. Just came to know that you are on stackoverflow. Please if you can help me out. That will be great ;) - Mohit Jain
Are you required the client_side_validations javascripts? - Mab879
Yes. Client side validations are working in all other forms except devise ones. - Mohit Jain
What do the require lines look like in your JS/coffee files? - Matt Huggins
@MattHuggins //= require rails.validations //= require rails.validations.formtastic - Mohit Jain

1 Answers

3
votes

First, I would recommend upgrading to client_side_validations 3.2.1, which is about a month old, even though I don't see any devise-specific bugfixes in this release.

Second, they are both great packages, but know that the history between devise and client_side_validations has been fraught with incompatibilities. Look through this search in the closed issues for csv to get a sense.

Third, make sure you check out this page in the docs, which explains how to work around a javascript incompatibility with the email validation regex.

Finally, look through this new example application to make sure you are following the same patterns and practices.