[Zope] new be help with Zope / formulator

Roché Compaan roche at upfrontsystems.co.za
Wed Aug 18 14:28:45 EDT 2004


* Tuttle, Gene <cetuttle at rottlundhomes.com> [2004-08-16 21:44]:
> I am using this code to display a form
> 
> 
> <center>
> <table border="10" bgcolor="#999966" cellspacing=0 cellpadding=0>
> 
> <!--- get a list of all the fields in the form --->
> <dtml-in "AddBuyerForm.get_fields()">
> 
> <!--- rename each sequence item to field so they can be used more easily
> --->
> <dtml-let field=sequence-item>
> 
> <tr>
> <td align="right"><dtml-var "field.get_value('title')">: </td>
> <td><dtml-var "field.render()"></td>
> </tr>
> 
> </dtml-let>
> </dtml-in>
> <tr>
> <td></td>
> <td>
> <input type="submit" value="Submit" name="submit">
> <input type="submit" value="Done" name="done">
> </td>
> </tr>
> </table>
> 
> I want to display some data in some of the forms.
> the line:
> <td><dtml-var "field.render()"></td> 
> will do this.
> How do I know what field is being processed.
> Given I have a query (ZSQL Method) and  returning values from fields 
> with the same names as the fields in the form.  I need to match them up.
> Can some help me?

If they have the same names then you should be able to render the
correct value for a field by subscripting the record with the field.id:

    <dtml-var "field.render(record[field.getId()])">

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za


More information about the Zope mailing list