This problem is caused by my acknowledge of English and jQuery or maybe something else.
I was using tutorial for jQuery – http://blog.bernatfarrero.com/jquery-and-rails-3-mini-tutorial/ .
In my application.erb.html:
<%= javascript_include_tag :defaults, "rails.validations", "rails.validations.custom" %>
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"%>
<%=javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"%>
I think I didn’t included some library because my page in view.
But my page looks like:
0 Comments
Say something!
EDITED
My generator didn’t created js files,so I created file rails.validations.custom.js and added code from GitHub:
ClientSideValidations.validators.local['email'] = function(element, options) {
// Your validator code goes in here
if (!/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i.test(element.val())) {
// When the value fails to pass validation you need to return the error message.
// It can be derived from validator.message
return options.message;
}
}
The comments thread for the question is getting long, so I’m going to create an answer.
We have established by looking at the firebug console that two of your JavaScript files are not where your application expects them to be:
What you need to do is either move those two files to the
/assetsdirectory, or modify the file path to point to the location where those two files actually reside.I’m not a rails guy, but here is my guess about how you might do that:
I think this would look for the files in
/assets/jsdirectory, but obviously you would need to modify the path to point at the actual location of you files. I’m sure a rails developer will chime in and tell me if I’ve got the wrong end of the stick!