Obviously, there's a lot more you can do with Zope than just this. One of the coolest things has to be the ability to enforce data types and checks on the data entered into a form. If you've ever had to code a form processor, this capability is sure to save you a couple of hours of work.
Let's see how it works, by modifying the Form object created previously:
In this case, I've specified that the first two fields must contain string values,
while the third must contain an integer. Assuming, for example, that the user enters a string instead of an integer into the last field, Zope will halt form processing and display an error message. Here's what it looks like:
A little scary, but nevertheless effective in communicating the error. Obviously, you can customize this page to your own requirements.
A number of types can be enforced on form variables - here's a quick list:
"float" - a floating-point number;
"int" - an integer;
"long" - a long integer;
"string" -a character string;
"text" - a line-separated string;
"lines" - a list of values separated by lines;
"date" - a date/time value
You can enforce that a field typed as "string" be non-empty by using the "required" value in it. For example, the following code modifies the Form object above to require information on the home planet: