django-ajax-forms is a client side JavaScript validation for any Django form.
Simple Examples
A complete example is included in the source repository and includes several samples of the library in use.
A basic example of usage:
{% load ajax_form_utils %}
< form method="post" >
< table >
{{ form.as_table }}
< tr >< td >< /td >< td >< input type="submit" / >< /td >< /tr >
< /table >
< /form >
< script type="text/javascript" >
$(function(){
$('form').validation({% render_ajax_fields form %});
});
< /script >
With DL rendering:
{% load ajax_form_utils %}
< form method="post" >
< dl >
{{ as_dl form }}
< dd >< /dd >
< /dl >
< /form >
< script type="text/javascript" >
$(function(){
$('form').validation({% render_ajax_fields form %}, {
layout: 'dl'
});
});
< /script >
Product's homepage
Here are some key features of "django-ajax-forms":
· Template tag to provide JavaScipt (JSON) field description of any Django form via introspection.
· Extended attributes defined on the form (similar to inner Meta classs)
· Custom validation, similar to how clean is used in Form classes
· Comparison between fields (ie compare password and password check fields)
· Support for custom fields (ie fields that are not part of the Django distribution)
· Output form using a structure
· Caching of generated JSON. Uses the built in caching framework to cache generated JSON.
Requirements:
· Python
· Django
· jQuery