"Paulo" == Paulo Eduardo Neves <neves@inf.puc-rio.br> writes:
Paulo> Is there a best way to validate input form data? Jim> What would you like to do if an input is not valid? Paulo> Probably show the same form and the completed data with an Paulo> error message indicating why some fields were not valid. At Paulo> least a message in portuguese, since most of my readers won't Paulo> understand the english error message. Paulo> I was thinking about coding a javascript library to validate Paulo> the data in the client, but I'm convinced now that it isn't Paulo> the way to go. If I use the "automatic" error handling Paulo> feature I *can't* properly (from a usability view) handle it. A while back I wrote a javascript module that does exactly this -- it automatically tries to validate the form elements on the client-side. You still need to do validation on the server side (for many many reasons), but I figured it was better to try and catch things client-side. This reduces the likelihood of the user actually seeing the "automatic" error from Zope while still letting you use the marshalling, which is nice. Last time I posted this (on the Bobo list) there wasn't much of a reaction, but maybe there will be this time. If anyone decides to use it, please note that the module doesn't know how to validate some :tags since I only implemented the easy ones and those which I needed myself. - Andrew -- #!/usr/bin/env python print(lambda s:s+"("+`s`+")")\ ('#!/usr/bin/env python\012print(lambda s:s+"("+`s`+")")\\\012') print(lambda x:x%`x`)('print(lambda x:x%%`x`)(%s)')