[Zope] Python, Pre-Fill Form Fields

Paul Winkler pw_lists at slinkp.com
Mon Feb 23 15:28:14 EST 2004


On Mon, Feb 23, 2004 at 03:06:12PM -0500, AdvertisingDept wrote:
> thanks Paul, but...
> 
> 
> How does my browser's back button fill in the form values?

Usually the browser remembers what you entered.
Maybe I don't understand the question.
 
> Is there really no way to set a value into 
> the FORM section of the REQUEST?

?  Of course there is. In python you can do
REQUEST.form.set('foo', 'some value')
Or you can arrange for the user to visit a url that
includes it in the query string, like 
http://server:port/name_of_page?foo=bar

Either way, you still have to arrange for the
form to show the value, so you still need
the tal:attributes expression.
 
> For each input tag, setting up a tal lookup and fill-in,
>    A. seems like a lot of work

If you don't want to do it by hand, maybe look at products
like Formulator and Archetypes which do a lot of
form layout work for you.

>    B. violates the ZPT concept of separating logic from layout.

I think you've misunderstood that. How do you expect it to work?

Default values in a form are an example of presentation
of data. This is certainly within the domain of ZPT.
It is not business logic.
You can't present data without somehow telling the template
what data to present.
 
-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's THE LAST SUPERDEAD ENCEPHALOPATHY BISHOP!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list