Philipp, Thanks for taking the time to respond - your answer helps
me at a couple of levels:

 a) I know now how to do it.
 b) It suggests that it is "good practice" to use the builtin widgets for 
    your own UI.


Philipp von Weitershausen writes:
 > Roy Mathew wrote:
 > > I need prettier edit widgets than the stock Rotterdam/Basic skin
 > > versions.
 > The skins have little to do with it, except for the CSS styles that 
 > apply to pretty much all HTML.
 > > Is there a collection of such widgets that maybe use
 > > dojo/mochikit/scriptaculous. Or is it reasonable to simple re-style
 > > (w/css) the stock widgets, or programmatically (in editform)
 > > manipulate parameters, to get reasonable edit widgets.
 > There are several options. First of all, you can style the existing 
 > widgets with CSS. If you want to change their behaviour (JavaScript, 
 > etc.), then you're probably best of writing your own widgets. Often you 
 > can simply subclass the original ones in and 
 > override the __call__ method (which returns the widget's HTML).
 > To use your custom widgets in your forms, you have two options:
 > a) explicitly refer to them in form_fields:
 >     class MyForm(EditForm):
 >         form_fields = Fields(IMySchema)
 >         form_fields['afield'].custom_widget = MyCoolWidget
 > b) register them for the fields you use, so they get picked up 
 > automatically whenever a TextLine, Int, Choice, etc. field is used in a 
 > form (even in Zope 3 itself). See 
 > for exmaples of how the standard Zope 3 widgets are registered. By the 
 > way, instead of using IBrowserRequest, you probably may want to specify 
 > the interface of your custom layer or skin the 'type' argument to <view 
 > />. Or you have to use overrides.zcml, otherwise you'll get conflicts 
 > (obviously).
 > HTH
 > -- 
 > -- Professional Zope documentation and training
 > 2nd edition of Web Component Development with Zope 3 is now shipping!
Zope3-users mailing list

Reply via email to