Stuart 'Zen' Bishop wrote:
On Thu, 9 Dec 1999, Henny van der Linde wrote:
I have a date field. I want to check, before submitting the form, if the date entered is valid. Is there someting like a function as: Date.IsValid (I haven a Delphi
background). What I don't want is a Zope generated standard error screen. I want a custom designed error message/page.
There are two options really: 1) Write nifty JavaScript to validate at the client before submitting to the server. This code doesn't exist in a general Zope form, but lots of us would like it :-)
2) Use <dtml-try> <dtml-except> clauses in the DTML method that accepts your form input, so if an exception is thrown converting a submitted string to a date, for instance, you can display a nice error message.
Another way is to avoid the introduction of a bad date in first place. You could use a list for day, month and even for year. JD