Numeric Input State Variable Reference

Table of contents


Introduction

Numeric Input state variables represent user number inputs. Each rendered component will display according to the format and limits specified in the state variable.

MVCS supports three types of numeric input mechanisms: a physical or virtual keyboard, a popup keypad, or a thumbwheel. The app Settings page can select the desired input mechanism for each device type by setting the sv.set_numInputType state variable. See Standard Settings Page.

If the state variable's ID contains a subName (e.g., 'myPage_mySv_kg'), it will be considered a unit specifier. If a rendered numeric input component has the showUnits attribute, the unit abbreviation for the unit subName will be displayed after the number.

Constructor

Syntax

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

Parameters

Note: If the info.id contains a subName (e.g., 'myPage_mySv_kg'), the first subName is stored in the unit property and isUnit is true. The unit is used only for display (see showUnits); unit conversion requires a unitInput state variable.


Instance methods

Inherited methods

val([value])

Gets or sets the value. A NaN is converted to INVALID_NONE, and the value is passed through fmt.apply() (rounding to rndMult) before being stored.

userChange(value)

Called by the component with the value the user entered. A string has commas removed and is converted to a Number. A non-finite value is ignored with the notice "Invalid value. Ignoring." A value outside the fmt limits is clamped to the limits with the notice "Value outside limits. Adjusting." The clamped, rounded value is then stored and a sync is forced so the displayed input reflects the stored value.

isValid([value])

True if the InputSv test passes and fmt.isValid(value) (value within the format's limits).

fmtVal()

Returns the value formatted by fmt. Returns '-' if the value is outside the format's range, or the Error text if the value is an Error.

Note: The component() method returns a NumInputSvCmp.


Instance properties

Inherited properties


fmt

A NumFmt instance specifies the desired numeric format and limits. The instance is held in the child state variable childSv.fmt (a modelObject). Assigning a new NumFmt replaces it, clamps the current value to the new limits and notifies monitors of the change, which causes mounted components to remount.

Value

A NumFmt instance.


max

The maximum valid value. Sets/gets fmt.max.

Value

A Number.


min

The minimum valid value. Sets/gets fmt.min.

Value

A Number.


isNumber

Always true for numericInput.

Value

A Boolean.


isUnit

True if the state variable has a unit subName.

Value

A Boolean.


unit

The first subName. For example, 'kg' if the state variable ID is 'myPage_mySv_kg'.

Value

A String.


Component attributes

Inherited attributes


numInputType

The numInputType attribute establishes a particular user input type that overrides the sv.set_numInputType state variable. If the attribute is not specified, the current value of sv.set_numInputType is used (and the component remounts if it changes). The values can be:

Value

A String.


fmt

A NumFmt instance or format string that overrides the state variable's fmt for this component only.


valueOnly

If true, the component renders as a numericOutput component (display only).


plusMinus

If plusMinus is true, then "-" and "+" buttons will apear to the left and right of the input. Pressing one of the buttons will increment or decrement the value by fmt.rndMult.

Value

A Boolean.

DOM element properties