Skip to main content

A collection of widgets and templates, and other components for with z3c.form in Plone

Project description

Abstract

A collection of widgets and templates, and other components for use with z3c.form in Plone. This is much related to plone.z3cform, the library that enables Zope 2 applications to use z3c.form.

WYSIWYG widget

The wysiwyg package provides an implementation of the Plone WYSIWYG widget compatible with z3c.form. This will allow you to use Kupu, FCKeditor and other editors compatible with the Plone WYSIWYG interface in your z3c.form forms.

To use, simply set the widget factory for the widget you’d like to be displayed with the WYSIWYG widget:

>>> from zope import interface, schema
>>> from z3c.form import form, field
>>> from z3c.form.interfaces import INPUT_MODE
>>> from plone.app.z3cform.wysiwyg.widget import WysiwygFieldWidget
>>> class IProfile(interface.Interface):
...     name = schema.TextLine(title=u"Name")
...     age = schema.Int(title=u"Age")
...     bio = schema.Text(title=u"Bio")
>>> class MyForm(form.Form):
...     fields = field.Fields(IProfile)
...     fields['bio'].widgetFactory[INPUT_MODE] = WysiwygFieldWidget

Query select widget

The queryselect module provides a query source compatible with z3c.formwidget.query which combines to a selection field that can be queried.

The native value type for the widget is Archetypes UID collections. The default implementation will simply search using the SearchableText index in the portal catalog.

This is how your form schema could look like:

>>> from zope import interface, schema
>>> from plone.app.z3cform.queryselect import ArchetypesContentSourceBinder
>>> class ISelection(interface.Interface):
...     items = schema.Set(
...         title=u"Selection",
...         description=u"Search for content",
...         value_type=schema.Choice(
...             source=ArchetypesContentSourceBinder()))

Optionally, instead of storing Archetypes UIDs, you can choose to use persistent.wref, i.e. weak references, instead of UIDs:

>>> from plone.app.z3cform.queryselect import uid2wref
>>> factory = uid2wref(ISelection['items'])

To store weak references instead of UIDs you would register such a factory as a component adapting the context. The factory automatically provides the interface which defines the field. (XXX: Please rewrite this paragraph.)

Changelog

0.3.1 - 2008-07-24

  • Fixed a bug where we would use the form macros defined in plone.z3cform instead of our own.

0.3 - 2008-07-24

  • Create this package from Plone-specific bits that have been factored out of plone.z3cform.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.app.z3cform-0.3.1.tar.gz (14.6 kB view details)

Uploaded Source

File details

Details for the file plone.app.z3cform-0.3.1.tar.gz.

File metadata

File hashes

Hashes for plone.app.z3cform-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5bbdc0f3311c5dd886285417524a2d97b8a5b4517a79be4df8cf63a362f55cd8
MD5 f74dfa5b0d434d356a2c11da9b4757d6
BLAKE2b-256 97a32acf8ae70ab38a774d8de37372892a092d3864924dc5c8f53f01e804ee3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page