[Zope3-Users] Overriding formlib field size

Fred Drake fdrake at gmail.com
Fri Feb 17 02:59:11 EST 2006


On 2/17/06, Brett Haydon <b.haydon at unsw.edu.au> wrote:
> I am just starting with zope 3.2 and am using the zope.formlib to generate a
> simple form. Where and how do I override the presentation aspect of
> the input field length in html.
> e.g. size="20"
> <div class="widget"><input class="textType" id="form.full_name"
> name="form.full_name" size="20" type="text" value="Brett Haydon"  /></div>

Perhaps the easiest way is to extend setUpWidgets():

class MyForm(zope.formlib.form.PageForm):

    form_fields = ...

    def setUpWidgets(self, ignore_request=False):
        super(MyForm, self).setUpWidgets(ignore_request=ignore_request)
        self.widgets['somefield'].displayWidth = 40


  -Fred

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


More information about the Zope3-users mailing list