开发者

Client Side Validations on Heroku

I am using https://github.com/bcardarella/client_side_validations to validate my sign up form.

I am validating the uniqueness of username and email in that form:

validates_uniqueness_of :username, :email, :case_sensitive => false

The database validations for uniqueness are taking place fine on my local machine. But when I try them on Heroku, they do not work.

Edit:

Here is the sign up form (I am using devise):

<%= form_for @user, :as => :user, :validate => true, :url => user_registration_path do |f| %>
    <div><%= f.label :name, :class => "signupin-label span-2" %><%= f.text_field :name, :class => "signupin-field last", :autocomplete => "off"%></div>
    <div><%= f.label :username, :class => "signupin-label span-2" %><%= f.text_field :username, :class => "signupin-field last", :autocomplete => "off" %></div>
    <div><%= f.label :email, :class => "signupin-label span-2" %><%= f.text_field :email, :class => "signupin-field last", :autocomplete => "off" %></div>
    <div><%= f.label :password, :class => "signupin-label span-2" %><%= f.password_field :password, :开发者_开发百科class => "signupin-field last", :autocomplete => "off" %></div>
    <div class="signupin-bl"><%= f.submit "Sign up", :id => "signUpButton"  %></div>
<% end %>

I am getting following error:

rails.validations.js:154

Uncaught TypeError: Object (?-mix:^(a-zA-Z*?|([a-zA-Z0-9]+_?)*)$) has no method 'test'

Can someone please guide?

Thanks!


I found the issue. I was not validating the format of username on the client side and that was causing this error. Thanks for your help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜