Class MochiKit.Widget.Field
Extends
MochiKit.Widget.
The field widget class. This widget is useful for providing
visible display of form data, using a <span> HTML
element.
Defined in: Widget.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MochiKit.Widget.Field(attrs)
Creates a new field widget.
|
- Fields borrowed from class MochiKit.Widget:
- _id, Classes
Method Attributes | Method Name and Description |
---|---|
reset()
Resets the field value to the initial value.
|
|
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
|
- Methods borrowed from class MochiKit.Widget:
- _animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addChildNode, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.Field(attrs)
Creates a new field widget.
var field = MochiKit.Widget.Field({ name: "ratio", format: "Ratio: {:%}" }); form.addAll(field); field.setAttrs({ value: 0.23 });
- Parameters:
- {Object} attrs
- the widget and node attributes
- {String} attrs.name
- the 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}"
- {Number} attrs.maxLength Optional
- the maximum data length, overflow will be displayed as a tooltip, defaults to -1 (unlimited)
- Returns:
- {Widget} the widget DOM node
Method Detail
reset()
Resets the field value to the initial value.
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 field name
- {String} attrs.value Optional
- the field value
- {String} attrs.format Optional
- the field format string
- {Number} attrs.maxLength Optional
- the maximum data length, overflow will be displayed as a tooltip