[ZPT] FORMs and processing

Steve Drees drees@the-bridge.net
Tue, 26 Jun 2001 08:57:52 -0500


> What's the received wisdom on using FORMs and PageTemplates? After a
> nightmare project where HTML coders were mangling DTML code I've
> decided to
> look at ZPT in a lot more detail...


Here's what I currently do:

<span tal:replace="request/ErrorMessage | nothing" />
<form action="process">
  <table>
    <tr tal:repeat="item here/is/some/sql">
      <td> something <td>
      <td tal:content="item/morestuff">From the sql</td>
      <td><input name="somethingelse" /></td>
    </tr>
    <tr><td><input type="submit"></td></tr>
  </table>
</form>



python script with id: process
if context.REQUEST.has_key('somethingelse'):
  return context.next_form(context)
else:
  context.REQUEST.set('ErrorMessage','You need to enter a value for
somethingelse')
  return context.first_form(context)