Proposal for a new form directive

JC Brand <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Hi Folks

I would like to propose a new plone form directive that allows you to
configure widgets without having to resort to the "updateWidgets" method
on a custom add/edit form.

Something like this:

    # Set custom widget
    form.widget(champion=widget.UserAndGroupSelectionFieldWidget)

    # Configure the widget
    form.configure(champion={
        'label': 'foo',
        'usersOnly': True
        'size': 10,
        'searchableProperties': ('fullname',)
    })

and if you want to restrict it to a specific interface:

    form.configure(IEditForm, champion={
        'label': 'foo',
        'usersOnly': True,
        'size': 10,
        'searchableProperties': ('fullname',)
    })

I think it's silly that we're able to hide and move around form widgets
via form directives but we have to resort to custom add/edit forms to do
simple widget customizations (like setting a custom label).

With Archetypes it was possible to customize the widget in your schema
declaration and I think it should be possible for z3c.form/Dexterity as
well.

I'm happy to implement this if people think it's a good idea, I'm going
to do part of it anyway because I need it in my specific usecase. So the
question is really if this can go into plone.directives.

Would this type of change require a PLIP? I assume so.

Regards
JC


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.