Personal tools
You are here: Home Products Archetypes Documentation Old Archetypes docs Archetypes 1.3.1 Widget Reference
Document Actions

Archetypes 1.3.1 Widget Reference

by Maik Roeder last modified September 10, 2007 - 09:05

Gives a quick overview of all properties of the default Archetypes 1.3.1 widgets.

Feedback to: Maik Röder, roeder@berg.net

Each Archetypes Field has a widget property defining the widget to be used for the Field. Widgets only work together with certain Fields.

Archetypes 1.3.1 Widget Reference

Feedback to: Maik Röder, roeder@berg.net

Each Archetypes Field has a widget property defining the widget to be used for the Field. Widgets only work together with certain Fields.

Name Default Description
description The help text for this Field. It is rendered like this:
<div class="formHelp"
     tal:define="description python:widget.Description(here)"
     tal:content="structure description"
     tal:attributes="id string:${fieldName}_help"
     i18n:translate="">
    Help
</div>
description_msgid "help_..." The i18n id for the help text. Usually used with a prefix of "help_", as in "help_template_mixin".
label The label of this field. It is rendered like this:
<label i18n:translate=""
       tal:content="python:widget.Label(here) + ':'">
    Field
</label>
label_msgid "label_..." The i18n id for the label usually with a prefix of "help_", like "label_copyrights".
visible {'edit':'visible', 'view':'visible'} Decides visibility in edit and view modes. There are three modes:
  • visible: The widget is rendered.
  • hidden: The field is rendered as a hidden field. For example, the creators property is hidden in edit and view mode. The layout property is hidden in view mode.
  • invisible: Not rendered at all. For example, the id is not rendered in view mode, and the creation_date and modification_date are invisible in edit mode.

To define both edit and view visibility, you can also use the following shorthands:

For visible:

  • visible = True
  • visible = 1

For hidden:

  • visible = False
  • visible = 0
For invisible:
  • visible = -1
macro "widgets/..." The widget to be used for rendering. The widget page template is found in the widgets subdirectory of the Archetypes skin. The following widgets are available: string, decimal, integer, reference, computed, textarea, lines, boolean, calendar, selection, multiselection, keyword, file, rich, zid, image, label, password, visual, epoz, inandout, picklist.
helper_css () A tuple containing a list of ids of .css files containing the CSS to be included when rendering any Archetypes template that the widget is a part of. Just make sure that the files you are pointing to exist somewhere in a skin layer, such as the custom layer or in a skin that is a part of a product you are writing. The Archetypes Page Templates base_edit.cpt, base_view.pt and base_metadata.cpt will include the CSS contained in your helper CSS as is.
helper_js () A tuple containing a list of ids of .js files containing the JavaScript to be included when rendering any Archetypes template that the widget is a part of. Just make sure that the files you are pointing to exist somewhere in a skin layer, such as the custom layer or in a skin that is a part of a product you are writing. The Archetypes Page Templates base_edit.cpt and base_metadata.cpt will include the JavaScript contained in your helper JavaScript as is. The use of helper JavaScript seems to be considered only helpful in edit forms, so the base_view.pt template does not include the JavaScript, although this may change in future versions of Archetypes.
postback True A boolean that decides whether this field is repopulated with a POSTed value when an error occurs while editing. In general all fields are repopulated when an error occurs, the only exception being the password widget, where we want to start with a clear field when the password was not correct.
populate True A boolean deciding whether this field should be populated in edit mode. This is true for all widgets except for the password widgets, which are usually not stored, but have to be entered manually.
modes ('view', 'edit') Used in view and edit screens to decide whether the widget is shown or not.
show_content_type False Currently not used in Archetypes. Only true for FileWidgets.
i18n_domain "plone" This property is not used in Archetypes templates, which are currently either using the plone or the archetypes i18n domain. You may decide to support this in your own templates, but you may also hard-code the domain. One example where the i18n domain support really makes sense is for vocabularies, which are depending on your problem domain. You can define the i18n_domain property on the Widget or on the Field, just keep in mind that the i18n_property defined on the Field takes priority.

StringWidget (widgets/string)

Renders a HTML text input box which accepts a single line of text

Special Properties
Name Type Default Description
maxlength integer 255 <input maxlength=
size 30 <input size=

TextAreaWidget (widgets/textarea)

Renders a HTML Text Area for typing a few lines of text

Special Properties
Name Type Default Description
rows integer 5 <textarea rows=
format 0 ?
cols integer 40 <textarea cols=
append_only boolean False Boolean that allows you to make an append-only TextArea widget. New text gets added to the top of the existing text, dividing the new text from the existing text using the divider property. The existing text is shown below the TextArea, and is not editable. This currently works with TextArea widgets and using plain text format.
divider string ======================== Which divider to use for append only text areas. Only used then the append_only property is True.

SelectionWidget (widgets/selection)

Renders a HTML selection widget, which can be represented as a dropdown, or as a group of radio buttons

Special Properties
Name Type Default Description
format flex Possible values: flex, select, radio. Uses radio buttons when set to radio, and a single-selection list when set to select. Using flex will automatically use single-selection lists for more than three settings at a time, and a single-select list for up to three settings.

MultiSelectionWidget (widgets/multiselection)

Renders a HTML selection widget, where you can be choose more than one value

Special Properties
Name Type Default Description
format select Possible values: select, checkbox. Uses a either a checkbox or a multi-selection list.
size 5 Defines the size of the multi-select list. Does not apply for checkboxes.

BooleanWidget (widgets/boolean)

Renders a HTML checkbox

RichWidget (widgets/rich)

Renders a HTML widget that allows you to type some content, choose formatting and/or upload a file

Special Properties
Name Type Default Description
rows integer 5 Number of rows
format 1 Apparently not used?
cols integer 40 Number of columns
allow_file_upload True Shows a file upload field under the text field.

LinesWidget (widgets/lines)

Renders a HTML textarea for a list of values, one per line

Special Properties
Name Type Default Description
rows integer 5 Rows of the lines widget.
cols integer 40 Columns of the lines widget.

ReferenceWidget (widgets/reference)

Renders a HTML text input box which accepts a reference value

Special Properties
Name Type Default Description
checkbox_bound 5 When the number of items exceeds this value, multi-selection lists are used. Otherwise, radio buttons or checkboxes are used.
destination None May be:
  • ".", context object;
  • None, any place where Field.allowed_types can be added;
  • string path;
  • name of method on instance (it can be a combination list);
  • a list, combining all item above;
  • a dict, where {portal_type:} destination is relative to portal root
addable False Create createObject link for every addable type
destination_types None Either a single type given as a string, or a list of types given as a string, defining what types we allow adding to. Only applies when addable is set on the widget.
Different Properties
Name Type Default
helper_css ('content_types.css',)

IntegerWidget (widgets/integer)

Renders a HTML text input box which accepts a integer value

Special Properties
Name Type Default Description
maxlength 255 Maximum input size
size 5 Size of the input field

CalendarWidget (widgets/calendar)

Renders a HTML input box with a helper popup box for choosing dates

Special Properties
Name Type Default Description
format Defines the strftime Format, e.g. '%d.%m.%Y' for the view.
future_years 5 Not supported by the plone templates yet.
starting_year 1999 Not supported by the plone templates yet.
ending_year None Not supported by the plone templates yet.
show_ymd True Not supported by the plone templates yet.
show_hm True Not supported by the plone templates yet.
Different Properties
Name Type Default
helper_css ('jscalendar/calendar-system.css',)
helper_js ('jscalendar/calendar_stripped.js', 'jscalendar/calendar-en.js')

IdWidget (widgets/zid)

Renders a HTML widget for typing an Id

Special Properties
Name Type Default Description
display_autogenerated True Not used any more. Instead, the "show_id" Python Script from plone_scripts is used to decide whether to show an id in an edit form.
is_autogenerated isIDAutoGenerated Not used any more. Instead, the "isIDAutoGenerated" Python Script from plone_scripts is used to determine whether an id is autogenerated

ImageWidget (widgets/image)

Renders a HTML widget for uploading/displaying an image

Special Properties
Name Type Default Description
display_threshold 102400 Only display the image inline if img.getSize() <= display_threshold
Different Properties
Name Type Default
show_content_type True

FileWidget (widgets/file)

Renders a HTML widget upload a file

Different Properties
Name Type Default
show_content_type True

DecimalWidget (widgets/decimal)

Renders a HTML text input box which accepts a fixed point value

Special Properties
Name Type Default Description
thousands_commas False Shows commas for thousands. Edit "7632654849635.02", and it is displayed as "7,632,654,849,635.02".
whole_dollars False Shows whole dollars in view, leaving out the cents. Enter "1.123", and "$1" is shown.
maxlength 255 Maximum input size
dollars_and_cents False Shows dollars and cents. Enter "123.123" and "$123.12" is shown.
size 5 Size of the input field

ComputedWidget (widgets/computed)

Renders the computed value as HTML

KeywordWidget (widgets/keyword)

Renders a HTML widget for choosing keywords

Special Properties
Name Type Default Description
vocab_source portal_catalog Defines the catalog to search for additional vocabulary to be combined with the vocabulary defined for the field. The Archetypes edit form uses the collectKeywords Python Script to bring together the additional and the predefined vocabulary. Additional keywords from existing content are found using catalog.uniqueValuesFor(fieldName). Additional keywords not added if the enforceVocabulary property of the Field is true.
roleBasedAdd True Only shows the "New keywords" form for adding keywords if the current user has one of the roles stored in the allowRolesToAddKeywords property in the site_properties property sheet in portal_properties
size 5 Size of the input field

PasswordWidget (widgets/password)

Renders a HTML password widget

Special Properties
Name Type Default Description
maxlength 255 Maximum input size
size 20 Size of the input field
Different Properties
Name Type Default
populate boolean False
postback boolean False
modes ('edit',)

InAndOutWidget (widgets/inandout)

Renders a widget for moving items from one list to another. Items are removed from the first list.

Special Properties
Name Type Default Description
checkbox_bound 5 Not used.
destination None See description for ReferenceWidget.
addable False See description for ReferenceWidget
size 6 Size of the select widget
destination_types None See description for ReferenceWidget
Different Properties
Name Type Default
helper_css ('content_types.css',)
helper_js ('widgets/js/inandout.js',)

EpozWidget (widgets/epoz)

Renders a HTML Epoz widget

Special Properties
Name Type Default Description
format 0 Apparently not used?
cols 40 Number of columns
rows 5 Rows of the textarea
append_only False Currently not implemented.
divider ======================== Currently not implemented.

VisualWidget (widgets/visual)

Renders a HTML visual editing widget widget

Special Properties
Name Type Default Description
format 0 Apparently not used?
cols integer 80 Number of columns of the Textarea.
height 400px Height of the edit form in pixel
rows integer 25 Number of rows of the Textarea.
append_only False Currently not implemented.
width 507px Width of the edit form in pixel.
divider
Currently not implemented.

LabelWidget (widgets/label)

Renders a HTML widget that only displays the label

PicklistWidget (widgets/picklist)

Render a widget to pick from one list to populate another. Items stay in the first list.

Special Properties
Name Type Default Description
size 6 description_PicklistWidget_size
Different Properties
Name Type Default
helper_js ('widgets/js/picklist.js',)

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by