> PS: There are some people in Dojo community, who work on form widget,
> which supports some validation mechanism. It would be nice to see what
> they do.
They do have some stuff to validate input. I found this file in their
repository:
http://dojotoolkit.org/trac/file/trunk/src/validate.js
It reminds me of:
http://code.djangoproject.com/browser/django/trunk/django/core/validators.py
Their code can validate individual values as well as all fields of the form
using some additonal meta-information.
Goofy idea: use the Python logic to generate JS code to do clientside validation based on the model-specified constraints. Detailed specification and implementation are left as an exercise to the reader. ;-)