Allow padding the decimal places with zeros.
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.
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.
Determine where should be positioned the caret on focus
Determine if a local list of AutoNumeric objects must be kept when initializing the elements and others
Currency symbol
Placement of the currency sign, relative to the number (as a prefix or a suffix)
Decimal separator character
Allow to declare alternative decimal separator which is automatically replaced by the real decimal character
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
Defines how many decimal places should be kept for the raw value.
The number of decimal places to show when unfocused
The number of decimal places to show when focused
Helper option for ASP.NET postback
This should be set as the value of the unformatted default value
Examples:
Thousand separator character
Whether this widget is initially disabled.
Define the number that will divide the current value shown when unfocused
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 pressedalways
: The currency sign is always displayedzero
: A zero is displayed (rounded
with or without a currency sign) if the input has no value on focus outmin
: The minimum value is displayed if the input has no value on focus outmax
: The maximum value is displayed if the input has no value on focus outnull
: 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)
.Defines if the custom and native events triggered by AutoNumeric should bubble up or not.
Defines if the custom and native events triggered by AutoNumeric should be cancelable.
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).
ID of the form to use for AJAX requests.
Determine if the default value will be formatted on initialization.
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.
Set the undo/redo history table size.
Each record keeps the raw value as well and the last known caret/selection positions.
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.
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.
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 :
Escape
, then the initial value saved on focus is set backEnter
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 valuecancel
, select the whole value (while respecting the selectNumberOnly
option)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 deleteddeny
: allows only one leading zero on values that are between 1 and -1keep
: allows leading zeros to be entered. on focusout zeros will be retainedDefines the maximum possible value a user can enter.
Notes:
minimumValue
Defines the minimum possible value a user can enter.
Notes:
maximumValue
Determine if the element value can be incremented / decremented with the up and down arrow keys.
Determine if the element value can be incremented / decremented with the mouse wheel.
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.
Placement of negative/positive sign relative to the currency symbol (possible options are l (left), r (right), p (prefix) and s (suffix))
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.
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.
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
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 validfloor
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 validignore
Ignores both the minimumValue
and maximumValue
settings
When using this option, the field will always be valid range-wiseinvalid
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 sentnull
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 validAlways undefined.
Defines the positive sign symbol.
It can be a string of only one character.
This is shown only if showPositiveSign
is set to true
.
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).
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.
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.
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.
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.
Defines the rounding method to use.
S
, Round-Half-Up Symmetric (default)A"
Round-Half-Up Asymmetrics
, 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 truncateF
, Round to Floor "Toward Negative Infinity"N05
Rounds to the nearest .05 => same as "CHF" used in 1.9X and still validU05
Rounds up to next .05D05
Rounds down to next .05Set 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.
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
Defines if the element value should be selected on focus.
Note: The selection is done using the selectNumberOnly
option.
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).
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.
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.
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).
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.
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
The symbolWhenUnfocused
option is a symbol placed as a suffix when not in focus.
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 :
Alt
key, andWe unformat again if:
Alt
againWhen 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.
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 :
fixed
step value (a positive float or integer number (ex: 1000
)), orprogressive
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.
The initial, numerical value that is displayed, such as 0.0
or 5.3
.
Provides a way for automatically replacing the formatted value with a pre-defined string, when the raw value is equal to a specific value.
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.
Defines when the wheel event will increment or decrement the element value.
focus
will only modify the value if the element is focused, andhover
will modify the value if the element is hovered (focused or not).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 :
fixed
step value (a positive float or integer (ex: number 1000
)), orThe 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.
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
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.