aps/TextArea

Analogue to the HTML ``textarea`` element.

A ``Textarea`` element that can be validated.

Compatibility

All user panels - CP and UX1

Overview

The aps/TextArea widget provides the functionality of the <textarea> HTML element.

Find the nested rules for this widget in the recommended Widget Hierarchy.

Examples

Basic Case

This demo code illustrates the widget activation through the widget constructor.

RUN DEMO

require(["aps/TextArea", "aps/Panel", "aps/FieldSet", "aps/PageContainer", "aps/ready!"],
function(TextArea, Panel, FieldSet, PageContainer) {
    var page = new PageContainer({}, "target");
    var panel = new Panel();
    var fieldset = new FieldSet();
    fieldset.addChild(new TextArea({
        label: "Enter test data",
        gridSize: "md-8",
        value: "",
        required: true
    }));
    panel.addChild(fieldset);
    page.addChild(panel);
    page.startup();
});

Input Field with Character Counter

This example shows how to use the widget loader as well as how to activate the character counter that shows the number of symbols left before the upper limit on the number of symbols is reached.

RUN DEMO

require(["aps/load", "aps/ready!"],
    function(load) {
        load(["aps/PageContainer", [
            ["aps/Panel", [
                ["aps/FieldSet", [
                    ["aps/TextBox", {
                        label: "Enter test data",
                        gridSize: "md-8",
                        value: "",
                        constraints: { maximumLength: 25},
                        showCharCounter: true,
                        required: true
        }]]]]]]]);
});

Public Properties

PROPERTY

TYPE

DEFAULT

DESCRIPTION

cols

number

20

The width of the field in characters.

constraints

object

{}

Sets the upper limit on the length of the input string: “constraints”: { “maximumLength”: <number>} Default value: {}</number>.

description

string

“”

Textual description to be displayed as a small greyed text under the control.

disabled

boolean

false

Specifies if the widget will respond to user input.

gridSize

string

undefined

This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles.

hint

string

“”

Help information in a widget.

isBusy

boolean

false

If the widget is busy then this property is true.

label

string

“”

Text that is shown as a label if the widget is placed inside a aps/FieldSet.

maxRangeMessage

undefined

.

missingMessage

string

This value is required.

The message to display if value is empty and the field is required.

optionalText

string

(Optional)

Text for optional widgets of the Input category.

placeHolder

string

“”

Grayed out initial string in a field.

required

boolean

false

User is required to enter data in the input field.

rows

number

2

Field height in lines of text.

showCharCounter

boolean

<strong>false</strong>

This property is used for displaying remaining characters counter for text input.

tooltipPosition

string[]

[] - PCP / CCP v1, undefined - CCP v2

See description of dijit/Tooltip.

visible

boolean

true

If this property value is set to true, then the widget is visible.

cols number

The width of the field in characters. In CCP v2, use gridSize instead. Default value: 20.

constraints object

Sets the upper limit on the length of the input string: “constraints”: { “maximumLength”: <number>} Default value: {}.</number>

description string

Textual description to be displayed as a small greyed text under the control. Default value: “”.

disabled boolean

Specifies if the widget will respond to user input.

Default value: false.

gridSize string

This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. In other cases it will be ignored.

gridSize string contains few options with number values (from 1 to 12) separated by spaces, which specify the grid size of the widget in different layouts:

- md - desktop

- xs - phone

For example, gridSize: “md-4 xs-2”.

All values below 1, e.g. “md-0”, will be replaced with the empty string (“”), values above 12, e.g. “md-14”, will be reduced to 12 (“md-12”).

Default value: undefined.

hint string

Help information in a widget. It is shown under the content of the widget. Deprecated in CCP v2. Default value: “”.

isBusy boolean

If the widget is busy then this property is true.

Default value: false.

label string

Text that is shown as a label if the widget is placed inside a aps/FieldSet.

Default value: “”.

missingMessage string

The message to display if value is empty and the field is required. The translated string value is read from the message file by default. Default value: “This value is required.”

optionalText string

Text for optional widgets of the Input category. Default value: “(Optional)”.

placeHolder string

Grayed out initial string in a field. For example, it can display instructions. Default value: “”.

required boolean

User is required to enter data in the input field. Default value: false.

rows number

Field height in lines of text. Default value: 2.

showCharCounter boolean

This property is used for displaying remaining characters counter for text input. Only shows up when input is in focus. Default value: false.

tooltipPosition string[]

See description of dijit/Tooltip.defaultPosition for details on this parameter. Default value: [] - PCP / CCP v1, undefined - CCP v2.

visible boolean

If this property value is set to true, then the widget is visible.

Default value: true.

Public Methods

METHOD

RETURN

DESCRIPTION

cancel ()

object

Sets the isBusy property to false

destroy ()

undefined

Destroy this widget

extraValidator ()

boolean

Here, you can do additional verifications

focus ()

aps/_input
function

Focusing on the focusNode of the current object

get ()

any

Get a property of the Stateful instance

getCustomErrorMessage ()

string

Here, you can return a custom error message

getParents ()

array

Discover and return all parents of the widget

placeAt ()

dijit/_widgetbase
function

Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions

reset ()

undefined.

Resets the widget’s value to what it was at initialization time

set ()

object
function

Set a property of the Stateful instance

startup ()

undefined

Gets started after the DOM fragment is added to the document

validate ()

boolean

Called by oninit, onblur, and onkeypress

cancel

Sets the isBusy property to false.

Return: object

destroy

Destroy this widget. Will also destroy any resources (including widgets) registered via this.own(). This method will also destroy internal widgets such as those created from a template.

Return: undefined

extraValidator

Here, you can do additional verifications.

Return: boolean

focus

Focusing on the focusNode of the current object.

Return: aps/_input function

get

Get a property of the Stateful instance. Get a named property of the Stateful object. The property may potentially be retrieved via a getter method in subclasses.

In the base class, this just retrieves the object’s property.

Return: any

getCustomErrorMessage

Here, you can return a custom error message. The method must return a value, only if additional verifications fail. To change standard error messages, use respective properties.

Return: string

getParents

Discover and return all parents of the widget.

Return: array

placeAt

Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions. A convenience function providing a simple shorthand mechanism to put an existing (or newly created) widget somewhere in the DOM, and allow chaining.

Return: dijit/_widgetbase function

reset

Resets the widget’s value to what it was at initialization time.

Return: undefined.

set

Set a property of the Stateful instance. Sets named properties of the stateful object and notifies the watchers of the property. A programmatic setter may be defined in subclasses.

Return: object function

startup

Gets started after the DOM fragment is added to the document Called after the widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().

Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. For widgets that need to do layout, it’s best to put that layout code inside resize(), and then extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible.

Return: undefined

validate

Called by oninit, onblur, and onkeypress. Show missing or invalid messages if appropriate, and highlight textbox field.

Return: boolean

Public Events

EVENT

RETURN

DESCRIPTION

onClick ()

undefined

The method is called when a user clicks on the widget

onClick

The method is called when a user clicks on the widget.