Class RapidContext.Widget.TextArea

Extends: RapidContext.Widget

The text area widget class. Used to provide a text input field spanning multiple rows, using the <textarea> HTML element.

Source code: RapidContext_Widget_TextArea.js

Class Summary
 
Creates a new text area (or text box) widget.
Field Summary
 
The value to use on form reset.
 
The read-only widget disabled flag.
 
The read-only widget focused flag.
Method Summary
 
Returns the text area value.
 
Resets the text area form 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
Event Summary
 
Emitted when the text is modified.
Class Detail
RapidContext.Widget.TextArea(attrs)
Creates a new text area (or text box) widget.
JavaScript:
var attrs = { name="description", helpText: "Description Text" };
var field = RapidContext.Widget.TextArea(attrs);
User Interface XML:
<TextArea name="description" helpText="Description Text" />
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.name Optional
the form field name
{String} attrs.value Optional
the field value, defaults to ""
{String} attrs.helpText Optional
the help text shown on empty input, defaults to ""
{Boolean} attrs.disabled Optional
the disabled widget flag, defaults to false
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to false
{Object} ... Optional
the initial text content
Returns:
{Widget} the widget DOM node
Field Detail
{Boolean} disabled
The read-only widget disabled flag.

{Boolean} focused
The read-only widget focused flag.

{String} defaultValue
The value to use on form reset.
Method Detail
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
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.helpText Optional
the help text shown on empty input
{Boolean} attrs.disabled Optional
the disabled widget flag
{Boolean} attrs.hidden Optional
the hidden widget flag

reset()
Resets the text area form value to the initial value.

{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 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
Event Detail
onchange()
Emitted when the text is modified. This event is triggered by both keypress and paste events if the text content is modified. The DOM standard onchange event may also be trigged (on blur).