======== AJAXForm ======== What is it? =========== This is a Django product that uses JavaScript and some server-side code to transparently add 'AJAX' support to Django forms. When a field in an AJAXForm is changed (and the form and JS are properly set up), the field data is submitted to the server using an asynchronous JS request, and validation information is returned to the client. The client can then display error information about the field or the entire form. How does it work? ================= To achieve all this, there's a special base class called 'AJAXForm' that forms should subclass. In addition to the usual form functionality, this base class implements functionality to validate seperate fields, and to store validated information in the session. When the user leaves the page, another view takes care of calling the form's save() method with the data from the session as form data, provided that all fields are validated properly. How do I use it? ================ To use AJAXForm, make sure the URLs are included in your urls.py, and the JavaScript from the 'media' directory is added to your templates. Then when a form is rendered that implements the AJAXForm base class, everything should work 'automagically', the JS code detects form changes and makes sure that the views are called, all you need to do is make sure that the form's save() method properly takes care of saving the data, and that the form's original POST URL exists as fallback for non-JS situations (this view will usually just call the form's save() method with request.POST data).