[Zope] populating form values from a sql method

Dieter Maurer dieter@handshake.de
Fri, 26 Jul 2002 20:42:52 +0200


Erik Myllymaki writes:
 > A users starts with a blank form.
 > 
 > She fills in some field values, slects some values form pull-downs.
 > 
 > Submits the form which adds a new record into a database.
 > 
 > Later, the user wants to update that infomation (or input a NEW record but
 > use that info as a template).
 > 
 > What is the cleanest way to pull up that form with the fields already
 > containing the data from that database record?
 > 
 > Is there a product that is close to this? Formulator?
I think, "Formulator" will help you.

It's not difficult, too, in plain coding provided there are no
name conflicts:

     <input ... value="&dtml.missing-column_name;">

This requires that the template is used within a

     <dtml-with "the_object">

for an update and without it for the initial insert.


In ZPT, it will look like

   <input ... tal:attributes="value obj/column_name | nothing">

where "obj" is defined for update and not defined for initial insert.


Dieter