> If I wanted to use formlib to build the form, and wanted to build a HTML
> widget for the image field that had a
> file input for uploading, and if img already had content woudl display a
> thumbnail; how would I go about this? I'm afraid I'm lost because its
> schema.Object that the widget would apply to (but I'm not sure).
In such case, I use custom widget.
from zope.app.form.browser.textwidgets import FileWidget
from zope.app.file.image import Image
class_ = Image
def _toFieldValue(self, input):
value = super(_toFieldValue, self)._toFieldValue(input)
from zope.formlib import form
form_fields = form.FormFields(IMyContent)
form_fields['image'].custom_widget = MyImageWidget
And there is widget subdirective in addform/editform directives in zcml.
Zope3-users mailing list