Text Input state variables represent text inputs. Each rendered component will display according to the format specified in the state variable.
'textInput', class: TextInputSvctl.createPage({
...,
stateVarInfo:[
{type:'textInput', ...},
],
})
infoinfo object can contain the following properties, but subclasses of StateVar may have additional properties:info properties.info properties.info properties.allCaps (optional)maxLength (optional)minLength (optional)pattern (optional)String.match() and passed to the DOM pattern attribute. Default: '' (no pattern).dflt (optional)''.size (optional)val()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()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.
allCapsIf true, the value will be converted to all capitals when assigned due to user input or otherwise.
A Boolean.
maxLengthThe maximum length of a valid input string. Default: undefined.
An integer Number.
minLengthThe minimum length of a valid input string.
An integer Number.
patternA pattern for a valid input string. Default: ''.
A String (a RegExp is also accepted by isValid(), but the DOM pattern attribute requires a string).
sizeThe width of the input field in characters. Default: maxLength or 16.
An integer Number.
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.
textInput Component will render an <input type="text"> with maxLength, minLength, pattern, and size attributes set according to the state variable instance properties.maxLength, minLength, pattern, and size attributes will be synchronized with the respective state variable properties.<input> element will have a className that contains 'svIo_textInput'.