[Zope] Validating data entry (dates)
Stuart 'Zen' Bishop
zen@cs.rmit.edu.au
Thu, 9 Dec 1999 12:17:04 +1100 (EST)
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.
--
___
// Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au
// E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au
//__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen