Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

z3c.form - custom terms for a radio widget

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


dan.fairs at gmail

May 8, 2009, 4:22 AM

Post #1 of 1 (414 views)
Permalink
z3c.form - custom terms for a radio widget

Hi,

I'm trying to override the default terms for a radio widget on a Bool
field. My schema and form are as follows:

class IBookingForm(Interface):
agree_tc = Bool(
title=u"Booking Terms and Conditions",
)

class BookingForm(AddForm):
fields = field.Fields(IBookingForm)

So, pretty straightforward. This renders out with 'yes' and 'no' as
the values. I'd like this to display as 'I agree' and 'I don't agree'.

The docs say that you should provide an alternate set of terms to
change the labels, so I have this class:

class TandCBoolTerms(term.BoolTerms):
trueLabel = u"I Agree"
falseLabel = u"I Don't Agree"

However, I'm now slightly at a loss as to how to register this terms
class for that single field on the form - the docs don't mention that!
Looking at the code, I can see the multi-adapter lookup in
z3c.form.widget.SelectWidget.updateTerms(), which looks like what I
want. Is there some kind of discriminator I can use (like the
StaticWidgetAttribute class) to help with this registration?

Thanks,
Dan
--
Dan Fairs <dan.fairs[at]gmail.com> | http://www.fezconsulting.com/

_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.