[Zope] Edit input forms using formulator

Lee.Marzke@ametek.com Lee.Marzke@ametek.com
Mon, 4 Mar 2002 11:14:10 -0500


I'm following the recommendations on using Formulator forms and info in 
the Book of Zope
and not having much luck translating the Add form ( which works great ) 
into an Edit form
that must be filled in with existing values.

My list method uses direct traversal to an zsql method, and I want to add 
an additional
path to the Formulator form which will pre-fill in the values

For instance, each item is listed with a link to the edit form like

[ <a href="<dtml-var URL1>/user_by_id/&dtml-userid;/forms/userEdit/"> Edit 
</a>

Where the user_by_id is a zsql method with direct traversal enabled.

I added the "field.render(field[field.getId()], REQUEST)  as suggested
by some archived email message but I get the error.

Error Type: AttributeError
          Error Value: __getitem__

When clicking the edit link.

Any suggestions or examples on how to get formulator ( or forms in
general ) to work with zsql would be appreciated.

PS: Keep it simple, I'm still fairly new to zsql and forms..

Thanks,

Lee Marzke <Lee.Marzke@ametek.com>



userEdit/index_html         Automatic Formulator form
===============================================================
<dtml-var standard_html_header>

<dtml-var "form.header()">


<table border="0" width="50%">
  <dtml-in "form.get_groups()">
  <dtml-let group=sequence-item>
    <tr><th colspan="2" bgcolor="#F8F8F8"><dtml-var group></th></tr>
    <tr>
      <dtml-in "form.get_fields_in_group(group)">
      <dtml-let field=sequence-item>
        <tr>
          <td><dtml-var "field.get_value('title')"></td>
          <td><dtml-var "field.render(field[field.getId()], 
REQUEST)"></td>
        </tr>
      </dtml-let>
      </dtml-in>
    </tr>
  </dtml-let>
  </dtml-in>
  <tr>
    <td><input type="submit" value=" OK "></td>
  </tr>
</table>


<dtml-var "form.footer()">
<dtml-var standard_html_footer>