Refine email confirmation: "invalid" for my client side check

I use gem judge to do client side input validation, but I am having some problems confirming the attribute emailin my model User. I use the devise validatable module to perform a uniqueness check email, as well as some regular expression checks that I assume.

When used judgein my form, I will return this error 'invalid when entering any message into my form.

Any idea why this is?

My initializer:

Judge.configure do
  expose User, :email
end

My js:

judge.validate document.getElementById("user_email"),
  valid: (element) ->
    console.log "Good job"
  invalid: (element, messages) ->
    console.log messages.join(', ')

My form:

= form_for(resource, :builder => Judge::FormBuilder, :as => resource_name, :url => registration_path(resource_name)) do |f|
  = f.text_field :email, :validate => true

My journal:

Started GET "/judge?klass=user&attribute=email&value=my%40email.com&kind=uniqueness" for 127.0.0.1 at 2014-06-03 18:44:37 +0200
Processing by Judge::ValidationsController#build as JSON
  Parameters: {"klass"=>"user", "attribute"=>"email", "value"=>"my@email.com", "kind"=>"uniqueness"}
Completed 200 OK in 5ms (Views: 0.2ms)

validatable User, .

+4

Source: https://habr.com/ru/post/1543719/


All Articles