app/views/pages/_form.html.haml in wheels-0.0.42 vs app/views/pages/_form.html.haml in wheels-0.0.43
- old
+ new
@@ -6,5 +6,22 @@
= render :partial => "form_fields", :locals=>{:f=>f}
- else
= form_for form_object, {:url=>form_url} do |f|
= render :partial => "form_fields", :locals=>{:f=>f}
+= content_for :head do
+ = javascript_include_tag 'jquery-validate/jquery.validate.pack'
+
+:javascript
+ $(function(){
+ jQuery.validator.addMethod("verify_user", function(value, element, params) {
+ //alert($(element).attr('data-verify-user-path'));
+ xhr = $.ajax({
+ async: false,
+ url: $(element).attr('data-verify-user-path')+ '?password='+value
+ });
+ return xhr.responseText=="true";
+ }, "Password is incorrect.");
+
+ $('form').validate();
+ });
+