I started with this amazing tutorial , but wanted to do keyboard validation and put my errors somewhere else. Remote verification displays its own error message at appropriate times, making me think that I worked. But if I ask if the field with remote validation really is, it says no, in fact, it does not.
In application.js, I have this ...
$("#new_user").validate({ rules: { "user[login]": {required: true, minlength: 3, remote: "/live_validations/check_login"}, }, messages: { "user[login]": {required: " ", minlength: " ", remote: " "}, } }); $("#user_login").keyup(function(){ if($(this).valid()){ $(this).siblings(".feedback").html("0"); }else{ $(this).siblings(".feedback").html("1"); } })
And then this is in the rails application ...
def check_login @user = User.find_by_login(params[:user][:login]) respond_to do |format| format.json { render :json => @user ? "false" : "true" } end end
I think that my problem may have everything related to this ticket in jQuery, and tried to implement this code, but being new to jQuery, it is all a little over my head. When I say a bit, I mean the way.
Any ideas to fix this, or a new way to look at it, would be of great help.
source share