Thanks for all the help with this. The javascript idea is a good quick fix so thanks for that, but it's obvious that, like many Zopish things, I need to re-think how I structure my forms. I'm impressed with this idea, though I don't yet fully understand it ! I'll work it out though ! Looking at this code I wonder if it is possible to make it into a ZClass or a Product or something so that we could re-use it and just substitute the variables. You would specify each variable, it's type (char, int etc), validation (either an external method or dtml), error messages and the ultimate destination for the input once valid. It's the kind of thing every self-respecting 4gl had in the 80's (I was there!). It's beyond me at the moment though. Richard
ie. form/index_html looks like
<dtml-if update.x> <dtml-if "not all_digits(entry)"> <dtml-call "REQUEST.set('errorMsg','Sorry, you must enter only digits')"> <dtml-elif "entry < 10"> <dtml-call "REQUEST.set('errorMsg','Sorry, the number is too small')"> </dtml-if>
<dtml-if errorMsg> <dtml-var submit_page> <dtml-else> do the work with the form data <dtml-var results_page> </dtml-if> <dtml-else> <dtml-var submit_page> </dtml-if>
form/submit page has the HTML form
<form method="post"> <dtml-if errorMsg> <FONT color=red><dtml-var errorMsg></Font> </dtml-if> Enter the data <input type=password name="entry" size=8 maxlength=10> <input type=image name="update" src="images/continue" value="submit_pin" border="0"> </form>
-- Rupert G. Goldie, Senior Software Engineer rgg@ekit-inc.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Richard Moon richard@dcs.co.uk