<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,35 +1,29 @@
-(function($)    {
-    function form_data(form)   {
-        return form.find(&quot;input[checked], input[type='text'], input[type='hidden'], input[type='password'], input[type='submit'], option[selected], textarea&quot;).filter(':enabled');
-    }
+(function($) {
     function inputs(form)   {
         return form.find(&quot;input, select, textarea&quot;);
     }
-    
+
     $.fn.validate = function(url, settings) {
         settings = $.extend({
             type: 'table',
             callback: false,
             fields: false,
             dom: this,
-            event: 'submit'
+            event: 'submit',
+            submitHandler: null
         }, settings);
-        
+
         return this.each(function() {
             var form = $(this);
             settings.dom.bind(settings.event, function()  {
-                var params = {};
-                form_data(form).each(function() {
-                    params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value; 
-                });
-                
                 var status = false;
+                var data = form.serialize();
                 if (settings.fields) {
-                    params.fields = settings.fields;
+                    data += $.param({fields: settings.fields});
                 }
                 $.ajax({
                     async: false,
-                    data: params,
+                    data: data,
                     dataType: 'json',
                     error: function(XHR, textStatus, errorThrown)   {
                         status = true;
@@ -89,6 +83,9 @@
                     type: 'POST',
                     url: url
                 });
+                if (status &amp;&amp; settings.submitHandler) {
+                    return settings.submitHandler.apply(this);
+                }
                 return status;
             });
         });</diff>
      <filename>ajax_validation/media/ajax_validation/js/jquery-ajax-validation.js</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,9 @@ Usage
 To use, Ajax Validation requires only that you add a URL(one per form), and some javascript to any page with the form.
 
 For example, if you had the following form::
-    
+
     from django import forms
-    
+
     class ContactForm(forms.Form):
         name = forms.CharField(label='Your Name')
         email = forms.EmailField(label='Your Email')
@@ -19,8 +19,8 @@ You would need to add the following url to your urls.py(you also need to import
     (r'^SOME/URL/$', 'ajax_validation.views.validate', {'form_class': ContactForm}, 'contact_form_validate')
 
 
-The URL can take any arguments(named, or unamed), and you can also provide a 
-callback function, this function is given request, \*args, and \*\*kwargs and 
+The URL can take any arguments(named, or unamed), and you can also provide a
+callback function, this function is given request, \*args, and \*\*kwargs and
 should return a dictionary which is passed to the form constructor.
 
 And then in the template in which you are displaying the form, you should add::
@@ -36,18 +36,22 @@ And then in the template in which you are displaying the form, you should add::
     &lt;/script&gt;
 
 As you can see, you need to have jQuery for this to work(here it is being loaded
-from google).  In the javascript you use jQuery's selectors to select where the 
-form is, and the validate method takes 5 parameters, all optional, first is the 
-URL of the validation, here we reverse the URL we set up earlier.  The second 
-parameter is a dictionary, it is optional and should either provide type(ul, 
-table, or p), this is the type of renderer you used for django's forms(form.as_p, 
-etc.), the default is table if nothing is provided.  It can also take a callback 
-option which is a function that recieves data, which is the JSON representation 
-of any errors, and form, which is the jquery object that you provided.  Finally, 
-it takes fields, which is a list of the fields that should be validated, it will 
-not display errors that aren't in that list of fields.  The last 2 options are 
-dom and event, these allow you to choose when the validation will occur, dom 
-should be a jQuery object(i.e.: $('#my_field')), and event should be a jQuery 
+from google).  In the javascript you use jQuery's selectors to select where the
+form is, and the validate method takes 5 parameters, all optional, first is the
+URL of the validation, here we reverse the URL we set up earlier.  The second
+parameter is a dictionary, it is optional and should either provide type(ul,
+table, or p), this is the type of renderer you used for django's forms(form.as_p,
+etc.), the default is table if nothing is provided.  It can also take a callback
+option which is a function that recieves data, which is the JSON representation
+of any errors, and form, which is the jquery object that you provided.  Finally,
+it takes fields, which is a list of the fields that should be validated, it will
+not display errors that aren't in that list of fields.  The last 2 options are
+dom and event, these allow you to choose when the validation will occur, dom
+should be a jQuery object(i.e.: $('#my_field')), and event should be a jQuery
 event(listed `here`_).
 
 .. _here: http://docs.jquery.com/Events/bind#overview
+
+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.</diff>
      <filename>docs/usage.txt</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d08441c33e8155d6a50d734bf666f8b32c3e3e0e</id>
    </parent>
  </parents>
  <author>
    <name>Alex Gaynor</name>
    <email>alex.gaynor@gmail.com</email>
  </author>
  <url>http://github.com/alex/django-ajax-validation/commit/47ca14610b736598d0399255ba5ad11df1a4a974</url>
  <id>47ca14610b736598d0399255ba5ad11df1a4a974</id>
  <committed-date>2009-07-01T14:11:33-07:00</committed-date>
  <authored-date>2009-07-01T14:11:33-07:00</authored-date>
  <message>Closes #1.  Added support for a submitHandler callback.  Thanks to Travis Cline</message>
  <tree>b94334200236085e88219780090144dd269698e6</tree>
  <committer>
    <name>Alex Gaynor</name>
    <email>alex.gaynor@gmail.com</email>
  </committer>
</commit>
