Options
All
  • Public
  • Public/Protected
  • All
Menu

The configuration for the InputNumber widget. You can access this configuration via BaseWidget.cfg. Please note that this configuration is usually meant to be read-only and should not be modified.

Hierarchy

Index

Properties

allowDecimalPadding?: string | number | boolean

Allow padding the decimal places with zeros.

default

true

alwaysAllowDecimalCharacter?: boolean

Defines if the decimal character or decimal character alternative should be accepted when there is already a decimal character shown in the element.

If set to true, any decimal character input will be accepted and will subsequently modify the decimal character position, as well as the rawValue.

If set to false, the decimal character and its alternative key will be dropped as before. This is the default setting.

default

false

behaviors: Record<string, Behavior>

A map with all behaviors that were defined for this widget. The key is the name of the behavior, the value is the callback function that is invoked when the behavior is called.

caretPositionOnFocus?: null | export=.CaretPositionOption

Determine where should be positioned the caret on focus

default

null

createLocalList?: boolean

Determine if a local list of AutoNumeric objects must be kept when initializing the elements and others

default

true

currencySymbol?: string

Currency symbol

default

''

currencySymbolPlacement?: export=.CurrencySymbolPlacementOption

Placement of the currency sign, relative to the number (as a prefix or a suffix)

default

'p'

decimalCharacter?: string

Decimal separator character

default

'.'

decimalCharacterAlternative?: null | string

Allow to declare alternative decimal separator which is automatically replaced by the real decimal character

default

null

decimalPlaces?: string | number

Defines the default number of decimal places to show on the formatted value, and to keep as the precision for the rawValue 0 or positive integer

default

2

decimalPlacesRawValue?: null | string | number

Defines how many decimal places should be kept for the raw value.

default

null

decimalPlacesShownOnBlur?: null | string | number

The number of decimal places to show when unfocused

default

null

decimalPlacesShownOnFocus?: null | string | number

The number of decimal places to show when focused

default

null

defaultValueOverride?: null | string | { doNotOverride: null }

Helper option for ASP.NET postback

This should be set as the value of the unformatted default value

Examples:

  • no default value="" {defaultValueOverride: ""}
  • value=1234.56 {defaultValueOverride: '1234.56'}
default

null

digitGroupSeparator?: string

Thousand separator character

default

','

digitalGroupSpacing?: export=.DigitalGroupSpacingOption
disabled: boolean

Whether this widget is initially disabled.

divisorWhenUnfocused?: null | string | number

Define the number that will divide the current value shown when unfocused

default

null

emptyInputBehavior?: export=.EmptyInputBehaviorOption

Defines what should be displayed in the element if the raw value is an empty string.

  • focus: The currency sign is displayed when the input receives focus (default)
  • press: The currency sign is displayed whenever a key is being pressed
  • always: The currency sign is always displayed
  • zero: A zero is displayed (rounded with or without a currency sign) if the input has no value on focus out
  • min: The minimum value is displayed if the input has no value on focus out
  • max: The maximum value is displayed if the input has no value on focus out
  • null: When the element is empty, the rawValue and the element value/text is set to null. This also allows to set the value to null using anElement.set(null).
eventBubbles?: boolean

Defines if the custom and native events triggered by AutoNumeric should bubble up or not.

eventIsCancelable?: boolean

Defines if the custom and native events triggered by AutoNumeric should be cancelable.

default

true

failOnUnknownOption?: boolean

This option is the strict mode (aka debug mode), which allows autoNumeric to strictly analyze the options passed, and fails if an unknown options is used in the settings object.

You should set that to true if you want to make sure you are only using pure autoNumeric settings objects in your code.

If you see uncaught errors in the console and your code starts to fail, this means somehow those options gets polluted by another program (which usually happens when using frameworks).

formId?: string

ID of the form to use for AJAX requests.

formatOnPageLoad?: boolean

Determine if the default value will be formatted on initialization.

formulaMode?: boolean

Defines if the formula mode can be activated by the user.

If set to true, then the user can enter the formula mode by entering the = character.

He will then be allowed to enter any simple math formula using numeric characters as well as the following operators +, -, *, /, ( and ).

The formula mode is closed when the user either validate their math expression using the Enter key, or when the element is blurred.

If the formula is invalid, the previous valid rawValue is set back, and the autoNumeric:invalidFormula event is sent.

When a valid formula is accepted, then its result is {@link AutoNumeric.prototype.set set}, and the autoNumeric:validFormula event is sent.

By default, this mode is disabled.

historySize?: string | number

Set the undo/redo history table size.

Each record keeps the raw value as well and the last known caret/selection positions.

id: string | string[]

The client-side ID of the widget, with all parent naming containers, such as myForm:myWidget. This is also the ID of the container HTML element for this widget. In case the widget needs multiple container elements (such as Paginator), this may also be an array if IDs.

invalidClass?: string

Defines the name of the CSS class to use on contenteditable-enabled elements when the value is invalid

This is not used when the HTML element used is an input.

isCancellable?: boolean

Allow the user to cancel and undo the changes he made to the given AutoNumeric-managed element, by pressing the Escape key.

Whenever the user validates the input (either by hitting Enter, or blurring the element), the new value is saved for subsequent cancellations.

The process :

  • save the input value on focus
  • if the user change the input value, and hit Escape, then the initial value saved on focus is set back
  • on the other hand if the user either have used Enter to validate (Enter throws a change event) his entries, or if the input value has been changed by another script in the mean time, then we save the new input value
  • on a successful cancel, select the whole value (while respecting the selectNumberOnly option)
  • bonus; if the value has not changed, hitting Esc just select all the input value (while respecting the selectNumberOnly option)

Controls the leading zero behavior

  • allow : allows leading zeros to be entered. Zeros will be truncated when entering additional digits. On focusout zeros will be deleted
  • deny : allows only one leading zero on values that are between 1 and -1
  • keep : allows leading zeros to be entered. on focusout zeros will be retained
maximumValue?: string

Defines the maximum possible value a user can enter.

Notes:

  • this value must be a string and use the period for the decimal point
  • this value needs to be larger than minimumValue
minimumValue?: string

Defines the minimum possible value a user can enter.

Notes:

  • this value must be a string and use the period for the decimal point
  • this value needs to be smaller than maximumValue
  • if this is superior to 0, then you'll effectively prevent your user to entirely delete the content of your element
modifyValueOnUpDownArrow?: boolean

Determine if the element value can be incremented / decremented with the up and down arrow keys.

modifyValueOnWheel?: boolean

Determine if the element value can be incremented / decremented with the mouse wheel.

negativeBracketsTypeOnBlur?: null | export=.NegativeBracketsTypeOnBlurOption

Adds brackets on negative values (ie. transforms -$ 999.99 to ($999.99))

Those brackets are visible only when the field does NOT have the focus.

The left and right symbols should be enclosed in quotes and separated by a comma.

negativePositiveSignPlacement?: export=.NegativePositiveSignPlacementOption

Placement of negative/positive sign relative to the currency symbol (possible options are l (left), r (right), p (prefix) and s (suffix))

default

null

negativeSignCharacter?: string

Defines if the negative sign should be toggled when hitting the negative or positive key multiple times.

When toggle is used, using the same - on + key will toggle between a positive and negative value.

When doNotToggle is used, using - will always set the value negative, and + will always set the value positive.

noEventListeners?: boolean

Defines if the element should have event listeners activated on it.

By default, those event listeners are only added to elements and html element with the contenteditable attribute set to true, but not on the other html tags.

This allows to initialize elements without any event listeners.

Warning: Since AutoNumeric will not check the input content after its initialization, using some autoNumeric methods afterwards will probably leads to formatting problems.

onInvalidPaste?: export=.OnInvalidPasteOption

Manage how autoNumeric react when the user tries to paste an invalid number.

  • error : (This is the default behavior) The input value is not changed and an error is output in the console.
  • ignore : idem than error, but fail silently without outputting any error/warning in the console.
  • clamp : if the pasted value is either too small or too big regarding the minimumValue and maximumValue range, then the result is clamped to those limits.
  • truncate : autoNumeric will insert as many pasted numbers it can at the initial caret/selection, until everything is pasted, or the range limit is hit. The non-pasted numbers are dropped and therefore not used at all.
  • replace : autoNumeric will first insert as many pasted numbers it can at the initial caret/selection, then if the range limit is hit, it will try to replace one by one the remaining initial numbers (on the right side of the caret) with the rest of the pasted numbers.

Note 1 : A paste content starting with a negative sign - will be accepted anywhere in the input, and will set the resulting value as a negative number

Note 2 : A paste content starting with a number will be accepted, even if the rest is gibberish (ie. 123foobar456). Only the first number will be used (here 123).

Note 3 : The paste event works with the decimalPlacesShownOnFocus option too.

Defines how the value should be formatted when wanting a localized version of it.

  • null or string => nnnn.nn or -nnnn.nn as text type. This is the default behavior.
  • number => nnnn.nn or -nnnn.nn as a Number (Warning: this works only for integers inferior to Number.MAX_SAFE_INTEGER)
  • , or -, => nnnn,nn or -nnnn,nn
  • .- => nnnn.nn or nnnn.nn-
  • ,- => nnnn,nn or nnnn,nn-

Note: The hyphen - is translated to the custom negative sign defined in negativeSignCharacter

overrideMinMaxLimits?: export=.OverrideMinMaxLimitsOption

Defines if AutoNumeric should let the user override the minimum and/or maximum limits when he types numbers in the element.

  • ceiling Strictly adheres to maximumValue and ignores the minimumValue settings It allows the user to enter anything between -∞ and maximumValue If maximumValue is less than 0, then it will prevent the user emptying the field or typing value above maximumValue, making sure the value entered is always valid
  • floor Strictly adheres to minimumValue and ignores the maximumValue settings It allows the user to enter anything between minimumValue and +∞ If minimumValue is higher than 0, then it will prevent the user emptying the field or typing value below minimumValue, making sure the value entered is always valid
  • ignore Ignores both the minimumValue and maximumValue settings When using this option, the field will always be valid range-wise
  • invalid The user can temporarily type out-of-bound values. In doing so, the invalid state is set on the field. Whenever an invalid value is typed, an autoNumeric:invalidValue event is sent When the value is correctly set back within the limit boundaries, the invalid state is removed, and the autoNumeric:correctedValue event is sent
  • null Strictly adheres to the maximumValue and minimumValue settings This is the default behavior If 0 is out of the min/max range, this will prevent the user clearing the input field, making sure the value entered is always valid
pluginOptions: undefined

Always undefined.

positiveSignCharacter?: string

Defines the positive sign symbol.

It can be a string of only one character.

This is shown only if showPositiveSign is set to true.

postConstruct: PostConstructCallback

An optional callback that is invoked after this widget was created successfully, at the end of the init method. This is usually specified via the widgetPostConstruct attribute on the JSF component. Note that this is also called during a refresh (AJAX update).

postRefresh: PostRefreshCallback

An optional callback that is invoked after this widget was refreshed after an AJAX update, at the end of the refresh method. This is usually specified via the widgetPostRefresh attribute on the JSF component.

preDestroy: PreDestroyCallback

An optional callback that is invoked before this widget is about to be destroyed, e.g., when the component was removed at the end of an AJAX update. This is called at the beginning of the destroy method. This is usually specified via the widgetPreDestroy attribute on the JSF component.

rawValueDivisor?: null | string | number

The rawValueDivisor divides the formatted value shown in the AutoNumeric element and store the result in rawValue.

Given the 0.01234 raw value, the formatted value will be displayed as 1.234.

This is useful when displaying percentage for instance, and avoid the need to divide/multiply by 100 between the number shown and the raw value.

readOnly?: boolean

Defines if the element (<input> or another allowed html tag) should be set as read-only on initialization.

When set to true, then:

  • the readonly html property is added to the element on initialization, or

  • the contenteditable attribute is set to false on non-input elements.

roundingMethod?: export=.RoundingMethodOption

Defines the rounding method to use.

  • S, Round-Half-Up Symmetric (default)
  • A" Round-Half-Up Asymmetric
  • s, Round-Half-Down Symmetric (lower case s)
  • a, Round-Half-Down Asymmetric (lower case a)
  • B, Round-Half-Even "Bankers Rounding"
  • U, Round Up "Round-Away-From-Zero"
  • D, Round Down "Round-Toward-Zero" - same as truncate
  • `C", Round to Ceiling "Toward Positive Infinity"
  • F, Round to Floor "Toward Negative Infinity"
  • N05 Rounds to the nearest .05 => same as "CHF" used in 1.9X and still valid
  • U05 Rounds up to next .05
  • D05 Rounds down to next .05
saveValueToSessionStorage?: boolean

Set to true to allow the decimalPlacesShownOnFocus value to be saved with sessionStorage

If IE 6 or 7 is detected, the value will be saved as a session cookie.

selectNumberOnly?: boolean

Determine if the select all keyboard command will select the complete input text, or only the input numeric value

Note : If the currency symbol is between the numeric value and the negative sign, only the numeric value will be selected

selectOnFocus?: boolean

Defines if the element value should be selected on focus.

Note: The selection is done using the selectNumberOnly option.

serializeSpaces?: export=.SerializeSpacesOption

Defines how the serialize functions should treat the spaces.

Those spaces can either be converted to the plus sign +, which is the default, or to %20.

Both values being valid per the spec (http://www.w3.org/Addressing/URL/uri-spec.html).

Also see the summed up answer on http://stackoverflow.com/a/33939287.

tl;dr : Spaces should be converted to %20 before the ? sign, then converted to + after.

In our case since we serialize the query, we use + as the default (but allow the user to get back the old wrong behavior).

showOnlyNumbersOnFocus?: boolean

Defines if the element value should be converted to the raw value on focus (and back to the formatted on blur).

If set to true, then autoNumeric remove the thousand separator, currency symbol and suffix on focus.

Example:

If the input value is $ 1,999.88 suffix, on focus it becomes 1999.88 and back to $ 1,999.88 suffix on blur.

showPositiveSign?: boolean

Allow the positive sign symbol + to be displayed for positive numbers. By default, this positive sign is not shown. The sign placement is controlled by the negativePositiveSignPlacement option, mimicking the negative sign placement rules.

showWarnings?: boolean

Defines if warnings should be shown in the console.

Those warnings can be ignored, but are usually printed when something could be improved by the user (ie. option conflicts).

styleRules?: null | { negative?: string; positive?: null | string; ranges?: { class: string; max: number; min: number }[]; userDefined?: ({ classes: [string, string] | [string]; callback: any } | { classes: string[]; callback: any } | { callback: any })[] }

Defines the rules that calculate the CSS class(es) to apply on the element, based on the raw unformatted value.

This can also be used to call callbacks whenever the rawValue is updated.

suffixText?: string

Add a text on the right hand side of the element value.

This suffix text can have any characters in its string, except numeric characters and the negative/positive sign.

Example: dollars

symbolWhenUnfocused?: null | string

The symbolWhenUnfocused option is a symbol placed as a suffix when not in focus.

unformatOnHover?: boolean

Defines if the element value should be unformatted when the user hover his mouse over it while holding the Alt key. Unformatting there means that this removes any non-number characters and displays the raw value, as understood by Javascript (ie. 12.34 is a valid number, while 12,34 is not).

We reformat back before anything else if :

  • the user focus on the element by tabbing or clicking into it,
  • the user releases the Alt key, and
  • if we detect a mouseleave event.

We unformat again if:

  • while the mouse is over the element, the user hit Alt again
unformatOnSubmit?: boolean

When a submit event is detected in the parent form element, temporarily removes the formatting and set the rawValue in each AutoNumeric child element.

The output format is a numeric string (nnnn.nn or -nnnn.nn). The formatted values are immediately set back after the submit event.

upDownStep?: string | number

That option is linked to the modifyValueOnUpDownArrow one and will only be used if the latter is set to true. This option will modify the up/down arrow behavior and can be used in two ways, either by setting :

  • a fixed step value (a positive float or integer number (ex: 1000)), or
  • the progressive string.

The fixed mode always increment/decrement the element value by that amount, while respecting the minimumValue and maximumValue settings.

The progressive mode will increment/decrement the element value based on its current value. The bigger the number, the bigger the step, and vice versa.

valueToRender: string

The initial, numerical value that is displayed, such as 0.0 or 5.3.

valuesToStrings?: object

Provides a way for automatically replacing the formatted value with a pre-defined string, when the raw value is equal to a specific value.

watchExternalChanges?: boolean

Defines if the AutoNumeric element should watch external changes made without using .set(), but by using the basic aNElement.node().value = 42 notation.

If set to watch, then AutoNumeric will format the new value using .set() internally.

Otherwise it will neither format it, nor save it in the history.

wheelOn?: "focus" | "hover"

Defines when the wheel event will increment or decrement the element value.

  • focus will only modify the value if the element is focused, and
  • hover will modify the value if the element is hovered (focused or not).
wheelStep?: string | number

That option is linked to the modifyValueOnWheel one and will only be used if the latter is set to true. This option will modify the wheel behavior and can be used in two ways, either by setting :

  • a fixed step value (a positive float or integer (ex: number 1000)), or
  • the ``progressive` string.

The fixed mode always increment/decrement the element value by that amount, while respecting the minimumValue and maximumValue settings.

The progressive mode will increment/decrement the element value based on its current value. The bigger the number, the bigger the step, and vice versa.

widgetVar: string

The name of the widget variables of this widget. The widget variable can be used to access a widget instance by calling PF("myWidgetVar").

Generated using TypeDoc