[Zope] Still Chipping Away At Formulator/ZPT Interface

Clemens Robbenhaar robbenhaar@espresto.com
Mon, 4 Nov 2002 21:43:59 +0100


Hi beno,

 > Hi;
 > Okay, I *am* going to write a How-To on this when I get it all figured out 
 > with your help. This needs to be done.
 > In DTML, we do this to render the fields:
 > 
 > <dtml-in "form.get_fields()">
 > <dtml-let field=sequence-item>
 > <tr>
 > <td><dtml-var "field.get_value('title')"></td>
 > <td><dtml-var "field.render()"></td>

 OT: I am not very familiar with DTML, but I remember vaguely it is
recommended to use the more explicit syntax: 

  <dtml-var expr="field.render()">

(Well, its only a recommendation.)

 > 
 > etc. How do I do this same thing in Python? Here's the start of the code:
 > 
 > mailhost=getattr(context, context.superValues('Mail Host')[0].id)
 > 
 > This much works. Now, I need to be able to call the values of the 
 > Formulator form (named *email_us_formulator*). An example of a value is 
 > *YourEmail*. How would I access this value with Python?

 Maybe read the fine python tutorial ;-)

e.g. the equivalent to "<dtml-in> are "for" loops:

 form = context.email_us_formulator
 for fiels in form.fields():
   print '<td>' + field.get_value('title') + '</td>'

 Scott Burton has written an HowTo which may be helpful either:

http://www.zopelabs.com/cookbook/1032909599

 It is also linked via the Formulator page on zope.org ... looking up
the resources in the web may even be faster than asking the list ;)