[Zope3-Users] passing constructor args to BooleanRadioWidget in formlib

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed May 30 12:34:46 EDT 2007

On Sunday 27 May 2007 09:14, roymathew at bellsouth.net wrote:
> Hi all.. I'd like to use a BooleanRadioWidget in my formlib; I can say:    
>   IMyForm['foo'].custom_widget = BooleanRadioWidget
> but don't see how I can override the default true/false constructor
> args (currently they are ('on','off') and I'd like them to be
> ('yes','no'). Short of subclassing my RadioWidget, is there a way?

The best would be to write a function like this:

def MyBooleanWidget(field, request):
    return BooleanRadioWidget(field, request, true='yes', false='no')

 IMyForm['foo'].custom_widget = MyBooleanWidget

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

More information about the Zope3-users mailing list