Class MochiKit.Widget.TextArea
Extends
MochiKit.Widget.
The text area widget class. Used to provide a text input
field spanning multiple rows, using the <textarea> HTML
element.
Defined in: Widget.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MochiKit.Widget.TextArea(attrs)
Creates a new text area (or text box) widget.
|
Field Attributes | Field Name and Description |
---|---|
The value to use on form reset.
|
|
The widget disabled flag.
|
|
The read-only widget focused flag.
|
- Fields borrowed from class MochiKit.Widget:
- _id, Classes
Method Attributes | Method Name and Description |
---|---|
_handleFocus(evt)
Handles focus and blur events for this widget.
|
|
_render()
Updates the display of the widget content.
|
|
getValue()
Returns the text area value.
|
|
reset()
Resets the text area form 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.TextArea(attrs)
Creates a new text area (or text box) widget.
var field = MochiKit.Widget.TextArea({ helpText: "< Enter Data >" });
- Parameters:
- {Object} attrs
- the widget and node attributes
- {String} attrs.helpText Optional
- the help text shown on empty input, defaults to ""
- {String} attrs.value Optional
- the field value, defaults to ""
- {Object} ... Optional
- the initial text content
- Returns:
- {Widget} the widget DOM node
Field Detail
{String}
defaultValue
The value to use on form reset.
{Boolean}
disabled
The widget disabled flag.
{Boolean}
focused
The read-only widget focused flag.
Method Detail
_handleFocus(evt)
Handles focus and blur events for this widget.
- Parameters:
- evt
- the MochiKit.Signal.Event object
_render()
Updates the display of the widget content.
{String}
getValue()
Returns the text area value. This function is slightly different
from using the "value" property directly, since it will always
return the actual value string instead of the temporary help text
displayed when the text area is empty and unfocused.
var value = field.getValue(); var lines = value.split("\n"); lines = MochiKit.Base.map(MochiKit.Format.strip, lines); value = lines.join("\n"); field.setAttrs({ "value": value });
- Returns:
- {String} the field value
reset()
Resets the text area form value to the initial value.
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
var value = field.getValue(); var lines = value.split("\n"); lines = MochiKit.Base.map(MochiKit.Format.strip, lines); value = lines.join("\n"); field.setAttrs({ "value": value });
- Parameters:
- {Object} attrs
- the widget and node attributes to set
- {String} attrs.helpText Optional
- the help text shown on empty input
- {String} attrs.value Optional
- the field value