Albatross forms defines a number of standard fields. They are:
- Same as a text field but it doesn't display the characters as the user enters them.
A TextField with static content.
An integral value, get_value() will return an int type.
A floating point value, get_value() will return a float type.
As expected, get_value() will return a Boolean type.
Returns one of the values listed in the (value, display_value) list passed to the constructor. If the value can be converted to an int, it will be; otherwise it will be returned as a string.
FileField (XXX not implemented (yet))
Internal storage within a field
The interaction of the field with the browser is complicated because the browser requires and returns string values. That loses the type of the objects that the fields wrap.
To manage this, the field class notes when the field is rendered to the browser and converts the value to a string using the object's get_display_value method. When the values are posted back to the form by the browser, they are stored as strings. If you need to access the value stored in a field, use the get_value() method which tracks the type of the stored representation and does a conversion (using get_merge_value) when appropriate.