It would be nice, if client-side validation library would be generic enough to allow "real-time" validation and value completion. For example say we have a billing page with fields price, amount and total_price. What I would like is to have a mechanism for updating total_price every time either amount or price change.

Cheers,
Simon

Kevin Dangoor wrote:
Clearly, formencode couldn't *directly* handle clientside validation.
The idea is that the validation code for a value can conveniently live
in a single place. Consider also that some validations can be
represented by a regular expression... that kind of thing can work
server or client side with just a little wrapping. Here's a little
more specific of what I'm thinking:

* we extend FormEncode's Validator (or FancyValidator or whatever it
is) with a class that can also have a JSLink or JSSource. This could
be ClientServerValidator or some such.
* when a widget is asked for its javascript, it will check to see if
its validator provides javascript. If so, it will include that
javascript reference in the set that it returns.
* when the template is rendered, the JavaScript for validation is
included and is only included once because of the standard widget
mechanism for JavaScript

It's really quite doable, and you need to have both client side and
server side validation as a general rule because you can't trust the
client.

Kevin

Reply via email to