[Zope] The proper usage of Sequence-item

Dieter Maurer dieter@handshake.de
Wed, 19 Jul 2000 23:04:42 +0200 (CEST)


jesse writes:
 > I'm improving on Smarter forms so that instead of having to hard code every field into the code that checks for errors, it automaticly reads the dictionary that is in REQUEST and checks every key in it.  I'm trying to work with this...
 > ....
 >         <dtml-in "REQUEST.keys()">   
 > <dtml-comment> starting the loop </dtml-comment>
 >         <dtml-if "_[sequence-key].value('')">
 > <dtml-comment> I'm saying that if the current key is empty, display this. </dtml-comment>
I would use:

   <dtml-in "REQUEST.items()">
     <dtml-unless sequence-item> <!-- the value-->
       something wrong with <dtml-var sequence-key> <!-- the field name-->
     </dtml-unless>
   </dtml-in>.


However, as a user, I would not be too happy to get the internal field names.

Recently, I did something similar to you.
However, I used a list of dictionaries to describe the form.
Each list entry describes one form field as a dictionary
with keys "name", "title", "type", "condition", ...
The description is used both for creating the form and
for verifying that all requirements are met.


Dieter