Text Input State Variable Reference

Table of contents


Introduction

Text Input state variables represent text inputs. Each rendered component will display according to the format specified in the state variable.

Constructor

Syntax

ctl.createPage({
	...,
	stateVarInfo:[
		{type:'textInput', ...},
	],
})

Parameters


Instance methods

Inherited methods

val()

Syntax

val(value)
val()

Gets or sets the value. The value must be a string or an Error; otherwise an assertion fails. If allCaps is true, the value is converted to upper case.

isValid()

Syntax

isValid(value)
isValid()

Returns true if value (or the current value if omitted) is a string and, when maxLength is a non-negative number, its length is between minLength and maxLength, and, when pattern is non-empty, it matches pattern. Note that minLength is checked only if maxLength is specified.

Note: The component() method returns a TextInputSvCmp.


Instance properties

Inherited properties


allCaps

If true, the value will be converted to all capitals when assigned due to user input or otherwise.

Value

A Boolean.


maxLength

The maximum length of a valid input string. Default: undefined.

Value

An integer Number.


minLength

The minimum length of a valid input string.

Value

An integer Number.


pattern

A pattern for a valid input string. Default: ''.

Value

A String (a RegExp is also accepted by isValid(), but the DOM pattern attribute requires a string).


size

The width of the input field in characters. Default: maxLength or 16.

Value

An integer Number.


Child state variables

The text format is held in a public child state variable with the subname fmt (e.g., myPage_myText_fmt), of type viewObject. Its value is an object with the properties minLength, maxLength, size, and pattern. The minLength, maxLength, size, and pattern properties of the state variable get and set these values. The component monitors the child state variable to update the <input> element.


Component attributes

Inherited attributes


DOM element properties