Widgets

AjaxLookupField

class tw.dynforms.widgets.AjaxLookupField(*args, **kw)

A text field that searches using Ajax. The user is presented with a readable string, while internally the widget uses ID values. This is useful for foreign key relations to large tables, e.g. contact lists.

When the widget loses focus, it submits the value to a server-side controller method, that you define. The method will perform a search, returning the results to the client. If there is an exact match, the widget changes visually to confirm this; with multiple matches, the user must pick from a list. The controller method may call the ajax_helper method, to assist with its task. If ajax_helper is used, the data source must have a member function called text_search that takes a single string as a parameter, and returns a list of matching objects.

CascadingSingleSelectField

class tw.dynforms.widgets.CascadingSingleSelectField(*args, **kw)
This widget is a SingleSelectField with additional functionality to set the values of other widgets in the form, when the value in this control changes. The values to set are returned by an Ajax callback.

CustomisedForm

class tw.dynforms.widgets.CustomisedForm(*args, **kw)
A form that allows specification of several useful client-side behaviours.

FilteringGrid

class tw.dynforms.widgets.FilteringGrid(*args, **kw)
This widget displays a grid of data that can be filtered by the user. The datasrc and columns parameters must be specified to create a static grid; other parameters allow the developer to add filtering controls.

GrowingRepeater

class tw.dynforms.widgets.GrowingRepeater(*args, **kw)
A set of input widgets that can dynamically grow on the client. If the repeated widget is a FieldSet, the legend may include a double dollar symbol ($$), which will be replaced with the numerical index of the instance.

GrowingTableFieldSet

class tw.dynforms.widgets.GrowingTableFieldSet(*args, **kw)
A grid of input widgets that can dynamically grow on the client. This is useful for allowing users to enter a list of items that can vary in length. The widgets are presented as a grid, with each field being a column. Delete and undo functionality is provided. To function correctly, the widget must appear inside a CustomisedForm.

GrowingTableForm

class tw.dynforms.widgets.GrowingTableForm(*args, **kw)
A grid of input widgets that can dynamically grow on the client. This is useful for allowing users to enter a list of items that can vary in length. The widgets are presented as a grid, with each field being a column. Delete and undo functionality is provided.

HidingButton

class tw.dynforms.widgets.HidingButton(*args, **kw)
This provides a button that the user can use to hide or show another area of the form.

HidingCheckBox

class tw.dynforms.widgets.HidingCheckBox(*args, **kw)
This widget is a CheckBox with additional functionality to hide or show other widgets in the form, depending on the value selected. To function correctly, the widget must be used inside a suitable container, e.g. HidingTableForm, and the widget’s id must not contain an underscore.

HidingCheckBoxList

class tw.dynforms.widgets.HidingCheckBoxList(*args, **kw)
This widget is a CheckBoxList with additional functionality to hide or show other widgets in the form, depending on the value selected. To function correctly, the widget must be used inside a suitable container, e.g. HidingTableForm, and the widget’s id must not contain an underscore.

HidingRadioButtonList

class tw.dynforms.widgets.HidingRadioButtonList(*args, **kw)
This widget is a RadioButtonList with additional functionality to hide or show other widgets in the form, depending on the value selected. To function correctly, the widget must be used inside a suitable container, e.g. HidingTableForm, and the widget’s id must not contain an underscore.

HidingSingleSelectField

class tw.dynforms.widgets.HidingSingleSelectField(*args, **kw)
This widget is a SingleSelectField with additional functionality to hide or show other widgets in the form, depending on the value selected. To function correctly, the widget must be used inside a suitable container, e.g. HidingTableForm, and the widget’s id must not contain an underscore.

HidingTableFieldSet

class tw.dynforms.widgets.HidingTableFieldSet(*args, **kw)
A TableFieldSet that can contain hiding widgets.

HidingTableForm

class tw.dynforms.widgets.HidingTableForm(*args, **kw)
A TableForm that can contain hiding widgets.

OtherSingleSelectField

class tw.dynforms.widgets.OtherSingleSelectField(*args, **kw)
A SingleSelectField that has “Other” as an option. If a user selects “Other”, they are prompted to enter a text string. The validator stores the new text strings in the database.

WriteOnlyTextField

class tw.dynforms.widgets.WriteOnlyTextField(*args, **kw)
A text field that is write-only and never reveals database content. If a value exists in the database, a placeholder like “(supplied)” will be substituted. If the user does not modify the value, the validator will return a WriteOnlyMarker instance. Call strip_wo_markers to remove these from the dictionary.