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)
self.form_fields['firstname'].setRenderedValue(u'David')
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
--
Fred L. Drake, Jr.fdrake at gmail.com
There is no wealth but life. --John Ruskin
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users