Formulator Field - PatternField

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)

You can place text here that will be used as the default value of the field, unless the programmer supplies an override when the form is being generated.

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.

Display width (display_width)

The width in characters. Required.

Maximum input (display_maxwidth)

The maximum input in characters that the widget will allow. Required. If set to 0 or is left empty, there is no maximum. Note that is client side behavior only.

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.

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.

Maximum length (max_length)

The maximum amount of characters that can be entered in this field. If set to 0 or is left empty, there is no maximum. Note that this is server side validation.

Truncate (truncate)

If checked, truncate the field if it receives more input than is allowed. The normal behavior in this case is to raise a validation error, but the text can be silently truncated instead.

Pattern (pattern)

The pattern the value should conform to. Patterns are composed of digits ('d'), alphabetic characters ('e') and alphanumeric characters ('f'). Any other character in the pattern should appear literally in the value in that place. Internal whitespace is checked as well but may be included in any amount. Example: 'dddd ee' is a Dutch zipcode (postcode). NOTE: currently experimental and details may change!

More help

Field edit screen help