Re: Possible to control widgets in a (subtype of) RegistryEditForm
"David Glick (Plone)" <david.glick-z4DKO/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <[email protected]> |
On 2/18/15 6:16 AM, Christoph Pingel wrote:
> In my project, there is a form which inherits from
> plone.app.registry's RegistryEditForm.
>
> Now while this is an elegant way to build a form (schema is derived
> from an interface), I miss a way to customize the widgets in the form.
>
> I my case, I have 10 color strings which correspond to numbers from 1
> to 10, and I would like to use a custom widget or even build the form
> elements myself.
> The purpose is that the user should be able to use a JS color picker
> to edit the colors.
>
> What would be the most elegant way to achieve a custom widget in this
> case?
>
> thanks for any input, best regards,
> Christoph
>
>
RegistryEditForm extends AutoExtensibleForm from plone.autoform, so you
can use plone.autoform schema hints to specify the widget in your schema.
from plone.autoform import directives as form
from plone.supermodel import model
class ISettings(model.Schema):
color = schema.TextLine()
form.widget('color', MyCustomColorWidget)
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users