Package turbogears :: Package widgets :: Module forms :: Class FormField

Class FormField

source code

 object --+        
          |        
base.Widget --+    
              |    
    InputWidget --+
                  |
                 FormField
Known Subclasses:

An input widget that can be included inside a Form or Fieldset.

It accepts the following parameters (besides those listed at params):

label
   The label text that the container form/fieldset will generate for the
   widget. If empty, the capitalized name will be used.
help_text
   The help text that the container form/fieldset will generate for the
   widget.

Nested Classes

Inherited from base.Widget: __metaclass__

Instance Methods
 
__init__(self, *args, **kw)
Initialize an input widget.
source code
 
update_params(self, d)
Update the template parameters.
source code

Inherited from InputWidget: adjust_value, display, render

Inherited from base.Widget: __call__, __repr__, __setattr__, retrieve_css, retrieve_javascript

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables
  label = None
hash(x)
  help_text = None
hash(x)
  params = ['field_class', 'css_classes', 'convert']
  params_doc = {'convert': 'Should the value be coerced by the v...
  field_class = None
  css_classes = []

Inherited from InputWidget: convert, validator

Inherited from base.Widget: css, default, engine_name, javascript, template

Properties
  name
  is_required
  field_id

Inherited from InputWidget: error, fq_name, is_validated, name_path, path

Inherited from base.Widget: is_named

Inherited from object: __class__

Method Details

__init__(self, *args, **kw)
(Constructor)

source code 
Initialize an input widget.

It accepts the following parameters (besides those listed at params):

name:
    Name of the input element. Will be the name of the variable
    the widget's input will be available at when submitted.

validator:
    Formencode validator that will validate and coerce the input
    this widget generates.

Overrides: object.__init__
(inherited documentation)

update_params(self, d)

source code 

Update the template parameters.

This method will have the last chance to update the variables sent to the template for the specific request. All parameters listed at class attribute 'params' will be available at the 'params' dict this method receives.

*Must* call super(MyWidget, self).update_params(params) cooperatively, unless, of course, your know what you're doing. Preferably this should be done before any actual work is done in the method.

Overrides: base.Widget.update_params
(inherited documentation)

Class Variable Details

params_doc

Value:
{'convert': 'Should the value be coerced by the validator at display?'\
,
 'css_classes': 'List of extra CSS classes for the field',
 'field_class': 'CSS class for the field'}

Property Details

name

Get Method:
_get_name(self)
Set Method:
_set_name(self, name)

is_required

Get Method:
unreachable.is_required(self)

field_id

Get Method:
unreachable.field_id(self)