Formulator Field - ListField

Widget properties

Title (title)

The title of this field. This is the title of the field that will appear in the form when it is displayed. Required.

Description (description)

Description of this field. The description property can be used to add a short description of what a field does; such as this one.

Default (default)

The default value of the widget; this should be one of the elements in the list of items.

CSS class (css_class)

The CSS class of the field. This can be used to style your formulator fields using cascading style sheets. Not required.

Alternate name (alternate_name)

An alternative name for this field. This name will show up in the result dictionary when doing validation, and in the REQUEST if validation goes to request. This can be used to support names that cannot be used as Zope ids.

Hidden (hidden)

This field will be on the form, but as a hidden field. The contents of the hidden field will be the default value. Hidden fields are not visible but will be validated.

Select First Item (first_item)

If checked, the first item will always be selected if no initial default value is supplied.

Items (items)

Items in the field. Each row should contain an item. Use the | (pipe) character to separate what is shown to the user from the submitted value. If no | is supplied, the shown value for the item will be identical to the submitted value. Internally the items property returns a list. If a list item is a single value, that will be used for both the display and the submitted value. A list item can also be a tuple consisting of two elements. The first element of the tuple should be a string that is name of the item that should be displayed. The second element of the tuple should be the value that will be submitted. If you want to override this property you will therefore have to return such a list.

Size (size)

The display size in rows of the field. If set to 1, the widget will be displayed as a drop down box by many browsers, if set to something higher, a list will be shown. Required.

Extra (extra)

A string containing extra HTML code for attributes. This string will be literally included in the rendered field.This property can be useful if you want to add an onClick attribute to use with JavaScript, for instance.

Extra per item (extra_item)

A string containing extra HTML code for attributes. This string will be literally included each of the rendered items of the field. This property can be useful if you want to add a disabled attribute to disable all contained items, for instance.

Validator properties

Enabled (enabled)

If a field is not enabled, it will considered to be not in the form during rendering or validation. Be careful when you change this state dynamically (in the TALES tab): a user could submit a field that since got disabled, or get a validation error as a field suddenly got enabled that wasn't there when the form was drawn.

External Validator (external_validator)

When a method name is supplied, this method will be called each time this field is being validated. All other validation code is called first, however. The value (result of previous validation) and the REQUEST object will be passed as arguments to this method. Your method should return true if the validation succeeded. Anything else will cause 'external_validator_failed' to be raised.

Required (required)

Checked if the field is required; the user has to fill in some data.

Preserve whitespace (whitespace_preserve)

Checked if the field preserves whitespace. This means even just whitespace input is considered to be data.

Unicode (unicode)

Checked if the field delivers a unicode string instead of an 8-bit string.

More help

Field edit screen help