Class RapidContext.Widget.Field

Extends: RapidContext.Widget

The field widget class. This widget is useful for providing visible display of form data, using a <span> HTML element.

Source code: RapidContext_Widget_Field.js

Class Summary
 
Creates a new field widget.
Method Summary
 
Redraws the field from updated values or status.
 
Resets the field value to the initial value.
 
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Methods borrowed from class RapidContext.Widget:
addAll, addChildNode, addClass, animate, blurAll, destroy, disable, enable, getChildNodes, hasClass, hide, isDisabled, isHidden, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass, uid
Class Detail
RapidContext.Widget.Field(attrs)
Creates a new field widget.
JavaScript:
var attrs = { name: "ratio", value: 0.23, format: "Ratio: {:%}" };
var field = RapidContext.Widget.Field(attrs);
User Interface XML:
<Field name="ratio" value="0.23" format="Ratio: {:%}" />
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.name
the form field name
{String} attrs.value Optional
the initial field value, defaults to an empty string
{String} attrs.format Optional
the field format string, defaults to {:s}
{Function} attrs.formatter Optional
the value formatter function
{Number} attrs.maxLength Optional
the maximum data length, overflow will be displayed as a tooltip, defaults to -1 (unlimited)
{Boolean} attrs.mask Optional
the masked display flag, when set the field value is only displayed after the user has clicked the field, defaults to false
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to false
Returns:
{Widget} the widget DOM node
Method Detail
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
field.setAttrs({ value: 0.23 });
Parameters:
{Object} attrs
the widget and node attributes to set
{String} attrs.name Optional
the form field name
{String} attrs.value Optional
the field value
{String} attrs.format Optional
the field format string
{Function} attrs.formatter Optional
the value formatter function
{Number} attrs.maxLength Optional
the maximum data length, overflow will be displayed as a tooltip
{Boolean} attrs.mask Optional
the masked display flag, when set the field value is only displayed after the user has clicked the field
{Boolean} attrs.hidden Optional
the hidden widget flag

redraw()
Redraws the field from updated values or status. Note that this method is called automatically whenever the setAttrs() method is called.

reset()
Resets the field value to the initial value.