[ZPT] FORMs and processing
Tony McDonald
tony.mcdonald@ncl.ac.uk
Tue, 26 Jun 2001 21:38:39 +0100
On 26/6/01 2:57 pm, "Steve Drees" <drees@the-bridge.net> wrote:
>> 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)
>
This seems to imply two Page Templates (first_form and next_form)?
I really like the <span tal:replace="request/ErrorMessage | nothing" />
construct - very neat!
My Zen level is slowly increasing with PT, thanks Steve.
Tone.
--
Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope