Data Forms field.

Instance Variable fieldType Type of this field. One of 'boolean', 'fixed', 'hidden', 'jid-multi', 'jid-single', 'list-multi', 'list-single', 'text-multi', 'text-private', 'text-single'.

The default is 'text-single'.

(type: str)
Instance Variable var Field name. Optional if fieldType is 'fixed'. (type: str)
Instance Variable label Human readable label for this field. (type: unicode)
Instance Variable values The values for this field, for multi-valued field types, as a list of bool, unicode or JID. (type: list)
Instance Variable options List of possible values to choose from in a response to this form as a list of Options. (type: list)
Instance Variable desc Human readable description for this field. (type: unicode)
Instance Variable required Whether the field is required to be provided in a response to this form. (type: bool)
Method __init__ Initialize this field.
Method __repr__ Undocumented
Method typeCheck Check field properties agains the set field type.
Method toElement Return the DOM representation of this Field.
Static Method fromElement Undocumented
Static Method fromDict Create a field from a dictionary.
Method __value_set Setter of value property.
Method __value_get Getter of value property.
Static Method _parse_desc Undocumented
Static Method _parse_option Undocumented
Static Method _parse_required Undocumented
Static Method _parse_value Undocumented
fieldType =
Type of this field. One of 'boolean', 'fixed', 'hidden', 'jid-multi', 'jid-single', 'list-multi', 'list-single', 'text-multi', 'text-private', 'text-single'.

The default is 'text-single'.

(type: str)
var =
Field name. Optional if fieldType is 'fixed'. (type: str)
label =
Human readable label for this field. (type: unicode)
values =
The values for this field, for multi-valued field types, as a list of bool, unicode or JID. (type: list)
options =
List of possible values to choose from in a response to this form as a list of Options. (type: list)
desc =
Human readable description for this field. (type: unicode)
required =
Whether the field is required to be provided in a response to this form. (type: bool)
def __init__(self, fieldType='text-single', var=None, value=None, values=None, options=None, label=None, desc=None, required=False): (source)

Initialize this field.

See the identically named instance variables for descriptions.

If value is not None, it overrides values, setting the given value as the only value for this field.

def __repr__(self): (source)
Undocumented
def __value_set(self, value): (source)

Setter of value property.

Sets value as the only element of values.

def __value_get(self): (source)

Getter of value property.

Returns the first element of values, if present, or None.

def typeCheck(self): (source)

Check field properties agains the set field type.

def toElement(self, asForm=False): (source)

Return the DOM representation of this Field.

Returns (type: domish.Element.)
@staticmethod
def _parse_desc(field, element): (source)
Undocumented
@staticmethod
def _parse_option(field, element): (source)
Undocumented
@staticmethod
def _parse_required(field, element): (source)
Undocumented
@staticmethod
def _parse_value(field, element): (source)
Undocumented
@staticmethod
def fromElement(element): (source)
Undocumented
@staticmethod
def fromDict(fieldDict): (source)

Create a field from a dictionary.

This is a short hand for passing arguments directly on Field object creation. The field type is represented by the 'type' key. For 'options' the value is not a list of Options, but a dictionary keyed by value, with an optional label as value.

API Documentation for wokkel, generated by pydoctor at 2018-12-06 14:45:46.