Permalink
Browse files

Added support for django-uniform.

  • Loading branch information...
1 parent 7bb263d commit 02b68bcdaba828926931ad65c3a9a7347ae33e15 @alex committed Jan 16, 2010
Showing with 21 additions and 0 deletions.
  1. +13 −0 ajax_validation/media/ajax_validation/js/jquery-uni-form.js
  2. +8 −0 docs/usage.txt
@@ -0,0 +1,13 @@
+function uniform_callback(data, form) {
+ var field_divs = $(form).find(".ctrlHolder").filter(".error");
+ field_divs.removeClass("error");
+ field_divs.find(".errorField").remove();
+
+ $.each(data.errors, function(key, val) {
+ var field_div = $(form).find(".ctrlHolder").filter("#div_" + key);
+ field_div.addClass("error");
+ field_div.prepend('<p id="error_1_' + key + '" class="errorField">'
+ + val + '</p>');
+ });
+}
+
View
@@ -55,3 +55,11 @@ event(listed `here`_).
In addition you can provide a callable option, ``submitHandler``. This
recieves the form DOM object and can do whatever it pleases. If it returns
true the form will be submitted, else it won't.
+
+Using ``ajax-validation`` with ``django-uniform``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to use ``django-ajax-validation`` with ``django-uniform`` there is
+an extra included handler that works with it. To use it simply include the
+``jquery-uni-form.js`` file in your template and pass
+``callback: uniform_callback`` to ``jQuery.validate``.

0 comments on commit 02b68bc

Please sign in to comment.