FormKit.BaseFieldClasses
index
/usr/local/share/webware/FormKit/BaseFieldClasses.py

# This file contains the base classes for Field

 
Modules
       
string

 
Classes
       
FormKit.BaseTagClasses.HTMLElement
Field
ChooseField
CompoundField
exceptions.Exception(exceptions.BaseException)
MethodUndefined

 
class ChooseField(Field)
    Subclass of field that accomodates Field types that are for multiple choice form elements:
Select boxes, multi-select boxes, radio sets, checkbox sets
 
 
Method resolution order:
ChooseField
Field
FormKit.BaseTagClasses.HTMLElement

Methods defined here:
__init__(self, name, validators=[], label='', attributes={}, languageStandard='XHTML')
addChoice(self, value, label)
Pass in a value, and text label to add a selection to this ChoiceList
choiceList(self)
Public method to return the ChoiceList class instance (for access to its methods)
choices(self)
Public method to return the choice class instances that are in this select field
clearChoices(self)
setChoices(self, choiceListObject)
Pass a selectionList object to this field object to set its selection set
setID(self, string)
Public utility method to surgically override the id tag attribute
tag(self)
Public method to return the HTML tags for this field

Methods inherited from Field:
addValidator(self, validator)
Public method to add a validator instance to this field
clearValidators(self)
Public method to remove all validators from this field
default(self)
Public method to return the default value for this field (if any)
dump(self)
Public method for returning a generic lump of HTML to represent the field
error(self)
Public method to return any error message resulting from validation (returns None if no error)
setDefault(self, value)
Public method to directly set the default value of the field
validators(self)
Public method to return the list of validators assigned to this field (if any)

Methods inherited from FormKit.BaseTagClasses.HTMLElement:
addAttributes(self, attributes)
Public method for adding tag attributes; merges in a dictionary of tag attributes
addClass(self, klass)
Public method for appending a CSS class name to this tag; expects a string
addStyle(self, dict)
Public method for adding a style attribute to a tag; takes a dictionary;
the key is the directive, the value is the parameter.
Duplicate key names override their predecessor.
 
Input like this:
{ 'background-color': 'rgb(255,255,255)',
  'font-size: 11px' }
( trailing semicolon can be used, or not )
 
set a key to None or empty string to remove it from the set
attributes(self)
Returns a dictionary of field element attributes
clearClasses(self)
removes all CSS classes from the tag
id(self)
returns the dom id attribute of this htmlElement
label(self)
Generic label parameter access method
languageStandard(self)
Generic parameter access method
name(self)
Generic name parameter access method
setAccessKey(self, key)
Public method for setting the tab index of a field... pass a single character string (a letter)
setTabIndex(self, num)
Public method for setting the tab index of a field... pass an integer
value(self)
Generic field value access method

 
class CompoundField(Field)
    Abstract Subclass of Field that implements subfields, and modifies the behavior of the methods that Form uses to mess with fields
to accomodate subFields.
 
 
Method resolution order:
CompoundField
Field
FormKit.BaseTagClasses.HTMLElement

Methods defined here:
__init__(self, name, validators=[], label='', attributes={}, languageStandard='XHTML')
# Note, a Compound field can have it's own tags, or not, and can have subfields, or not
addSubField(self, field)
adds a field class instance to subfields
dump(self)
This isn't terribly useful as-is; you may want to make it more so in the sub-class
error(self)
Returns validation errors, allowing for the errors of the CompoundField's sub-fields
nativeValue(self)
the same as .value() if this were a non-compound field class
subFields(self)
returns a list of the sub fields
tag(self)
This isn't terribly useful as-is; you may want to make it more so in the sub-class
value(self)
access method that returns the 'value' of the compound set, NOT
the value of the main form field. This value is usually derived from
some combination of the field and its' subFields, or some other logic

Methods inherited from Field:
addValidator(self, validator)
Public method to add a validator instance to this field
clearValidators(self)
Public method to remove all validators from this field
default(self)
Public method to return the default value for this field (if any)
setDefault(self, value)
Public method to directly set the default value of the field
validators(self)
Public method to return the list of validators assigned to this field (if any)

Methods inherited from FormKit.BaseTagClasses.HTMLElement:
addAttributes(self, attributes)
Public method for adding tag attributes; merges in a dictionary of tag attributes
addClass(self, klass)
Public method for appending a CSS class name to this tag; expects a string
addStyle(self, dict)
Public method for adding a style attribute to a tag; takes a dictionary;
the key is the directive, the value is the parameter.
Duplicate key names override their predecessor.
 
Input like this:
{ 'background-color': 'rgb(255,255,255)',
  'font-size: 11px' }
( trailing semicolon can be used, or not )
 
set a key to None or empty string to remove it from the set
attributes(self)
Returns a dictionary of field element attributes
clearClasses(self)
removes all CSS classes from the tag
id(self)
returns the dom id attribute of this htmlElement
label(self)
Generic label parameter access method
languageStandard(self)
Generic parameter access method
name(self)
Generic name parameter access method
setAccessKey(self, key)
Public method for setting the tab index of a field... pass a single character string (a letter)
setID(self, string)
Public utility method to surgically override the id tag attribute
setTabIndex(self, num)
Public method for setting the tab index of a field... pass an integer

 
class Field(FormKit.BaseTagClasses.HTMLElement)
    # field is an abstract class. You will need to subclass it to make anything useful
 
  Methods defined here:
__init__(self, name, validators=[], label='', attributes={}, languageStandard='XHTML')
The bulk of Field's functionality derives from the code in HTMLElement. In addition,
the Field constructor sets up a bunch of additional containers; validators is a list of
validator/converter instances; the label is a string that is used by some field classes, but not
others, mainly for things like button labels; attributes is a dictionary of parameters that will
be added to the field's HTML tag; languageStandard is whether you want HTML or XHTML tags returned
addValidator(self, validator)
Public method to add a validator instance to this field
clearValidators(self)
Public method to remove all validators from this field
default(self)
Public method to return the default value for this field (if any)
dump(self)
Public method for returning a generic lump of HTML to represent the field
error(self)
Public method to return any error message resulting from validation (returns None if no error)
setDefault(self, value)
Public method to directly set the default value of the field
tag(self)
Public method for returning an <input> tag and nothing but an <input> tag; except when it doesn't, such as
with radio button sets where the radio switches mean nothing without their labels
validators(self)
Public method to return the list of validators assigned to this field (if any)

Methods inherited from FormKit.BaseTagClasses.HTMLElement:
addAttributes(self, attributes)
Public method for adding tag attributes; merges in a dictionary of tag attributes
addClass(self, klass)
Public method for appending a CSS class name to this tag; expects a string
addStyle(self, dict)
Public method for adding a style attribute to a tag; takes a dictionary;
the key is the directive, the value is the parameter.
Duplicate key names override their predecessor.
 
Input like this:
{ 'background-color': 'rgb(255,255,255)',
  'font-size: 11px' }
( trailing semicolon can be used, or not )
 
set a key to None or empty string to remove it from the set
attributes(self)
Returns a dictionary of field element attributes
clearClasses(self)
removes all CSS classes from the tag
id(self)
returns the dom id attribute of this htmlElement
label(self)
Generic label parameter access method
languageStandard(self)
Generic parameter access method
name(self)
Generic name parameter access method
setAccessKey(self, key)
Public method for setting the tab index of a field... pass a single character string (a letter)
setID(self, string)
Public utility method to surgically override the id tag attribute
setTabIndex(self, num)
Public method for setting the tab index of a field... pass an integer
value(self)
Generic field value access method

 
class MethodUndefined(exceptions.Exception)
    
Method resolution order:
MethodUndefined
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x600140>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message