On 3/14/06, David Johnson <[EMAIL PROTECTED]> wrote:
> I am experimenting with formlib, and I'm stuck on one point, how do you set
> the values of fields before they are rendered?
> How do I set the value of field before it is rendered?  I've been playing
> with things like:
> Form_fields['firstname'] = u'David'

The most basic approach is to extend the setUpWidgets() method:

    def setUpWidgets(self, ignore_request=False):
        super(MyFormClass, self).setUpWidgets(ignore_request=ignore_request)

Other ways to initialize the fields are documented in the form.txt
file in the zope.formlib package.  The add and edit forms usually do
the right thing for simple cases, and more elaborate form
initialization is pretty straightforward.


Fred L. Drake, Jr.    <fdrake at gmail.com>
"There is no wealth but life." --John Ruskin
Zope3-users mailing list

Reply via email to