## autoNumeric-2.0-BETA

last update 2015-02-77 GMT 7:30 PM

### New methods

"unSet" - displays the raw value of the input.

- $(selector).autoNumeric('unSet'); - returns a numeric string as 'nnnn.nn' with the period '.' as the decimal character
- $(selector).autoNumeric('unSet', 'asKomma'); - returns numeric string 'nnnn,nn' with the comma / Komma ',' as the decimal character
- $(selector).autoNumeric('unSet', 'checkOptions'); - checks the options for the input and returns numeric string 'nnnn.nn' or 'nnnn,nn' based on the settings.

- This displays unformatted (xxxx.xx) numeric strings in the form inputs that are controlled by autoNumeric.
- autoNumeric is not "destroyed" allowing you to easily reformat the field after the form has been posted via the "reSet" option of the "set" method (see below).
- The "unSet" method will display the expanded decimal places if the "eDec" option is used.

"reSet" - resets the unset value

- Convenient way to reset value after post

"wipe' - deletes the value and any sessionStorage or cookies that were created by autoNumeric

- Unlike the "destroy" method autoNumeric is still active
- See option aStor below

"destroy' - modified to delete value, sessionStorage or cookies that were created by autoNumeric and kills autoNumeric

### Modified methods

"get" - displays the raw value of the input.

- $(selector).autoNumeric('get'); - returns a numeric string as 'nnnn.nn' with the period '.' as the decinal charcter
- $(selector).autoNumeric('get', 'asKomma'); - returns numeric string 'nnnn,nn' with the comma / Komma ',' as the decinal charcter
- $(selector).autoNumeric('get', 'checkOptions'); - checks the options for the input and returns numeric string 'nnnn.nn' or 'nnn,nn' based on the settings.

"getString" - displays the raw value of the input.

- $(selector).autoNumeric('getString'); - returns a numeric string as 'nnnn.nn' with the period '.' as the decinal charcter
- $(selector).autoNumeric('getString', 'asKomma'); - returns numeric string 'nnnn,nn' with the comma / Komma ',' as the decinal charcter
- $(selector).autoNumeric('getString', 'checkOptions'); - checks the options for the input and returns numeric string 'nnnn.nn' or 'nnn,nn' based on the settings.

"getArray" - displays the raw value of the input.

- $(selector).autoNumeric('getArray'); - returns a numeric string as 'nnnn.nn' with the period '.' as the decinal charcter
- $(selector).autoNumeric('getArray', 'asKomma'); - returns numeric string 'nnnn,nn' with the comma / Komma ',' as the decinal charcter
- $(selector).autoNumeric('getArray', 'checkOptions'); - checks the options for the input and returns numeric string 'nnnn.nn' or 'nnn,nn' based on the settings.

### New options and modifications

"eDec" - this displays expanded decimal places when the input has focus.

- Default value "eDec: null"
- eDec - value must be enclosed in quotes - example eDec: '5'
- The "eDec" value should be either "null" or greater than the normal decimal places set by the "vMin" & "vMax" values or "mDec" option.
- If the value being "set" is longer than the "eDec" value being set will be rounded.
- Currently there is no padding when the input has focus.
- Note - "eDec" will function properly with the following exception: if the "aStor = false" (the default) and the client navigates away from the page the extended value is lost and will be replaced with the non extended value!
- Note - to ensure the extended value (eDec) is retained the "aStor" option must be set to "true" see details below.

"nSep" - this displays the number with decimal only when the input has focus.

- This is similar to the behavior of a spread spreadsheet
- On focusout the value is formatted again

"aStor" - when true allows the "eDec" value to be retained via sessionStorage on compatible browsers of a session cookie in EI 6 & 7.

- Default value "aStor: true"
- Set to "aStor: false" to NOT use session storage.
- Note - sessionStorage or session cookie is used only on fields when eDec does not equal null and is greater than mDec.
- Note - once the browser is shut down or the tab is closed all extended values held in sessionStorage or cookies are deleted.

"oRide" - overrides min / max values and controls the number of integers. Helpful when you run into the limits of javaScript math accuracy.

- Ooverrides min / max values and controls the number of integers (positive & negative) and decimal places (optional)
- example oRide: '6,0' allows 6 digits positive 0 negative
- Example oRide: '8,6,3' allow 8 positive integers 6 negative digits and three decimal places for both positive and negative
- 2 decimal places is the default - this can being changed as stated in the oRide option or mDec option

"pNeg" - positions the minus sign "-" to the left or the right of the currency sign.

- Only works when the currency sign is a prefix
- When the "-" is the the right of the currency sign "negative brackets will not function

"aSuffix" - allows a suffix to be place at the far right.

- Can be used with "aSign" in either prefix or suffix

"mRound" - added rounding method used in Switzerland

- mRound: "CHF" rounds to the nearest .X0 or .X5

"dGroup" - modified the digital grouping

- Support for a modified lakh "22,333,22,22,333.00" that can be used for scaling

"sNumber" - Modifies how the select all from keyboard functions

- determine if the select all keyboard command will select the complete input text or only the input numeric value

Notes:

- Default values and Values being set can use either the period '.' or Komma ',' as the decimal character

Demonstration showing the new features:

- Focus and focusout of the inputs to see the behavior for the different inputs.
- Change the values.
- Navigate away and return to see the values are retained and see how the "aStor" option behaves.
- Press the "unSet" and the "set" method with the "reSet" value.
- Press the "wipe" and try entering leters.
- Press the "destroy" and try entering leters.
- reload page and try more changes.

Input | Demonstrates | value and options
| eDec, aStor | value="1233333.888881" data-e-dec="5" data-a-stor=true
| eDec, aStor | value="-10000,009999" data-e-dec="10" data-v-min="-111111" data-n-bracket="(,)" data-a-stor=false
| nSep | value="12345" data-a-sign="€ " data-p-sign="s" data-n-sep=true
| nSep | value="1237658.98798798" data-a-sign="$ " data-n-sep=true
| aSuffix | value="12345" data-a-sign="$" data-p-sign="s" data-r-val=true
| aSuffix | value="1237658.98798798" data-a-sign="€" data-r-val=true
| eDec, nSep & aSuffix | value="1234.98798798" data-a-sign="$" data-e-dec="10" data-a-stor=true data-r-val=true
| oRide: '6,3' | data-o-ride="true" Overrides the min/max values and controls the number of intergers
| pNeg: 'left' | data-p-neg="left" places the minus sign to the left of the currency sign
| pNeg: 'right' | data-p-neg="right" places the minus sign to the right of the currency sign
| mRound='CHF' | data-m-round="CHF" rounds to the nearest .00 or .05
| dGroup: '2s' | data-m-round="2s" data-a-sign="Rs. " scalling for "Lakh Crore"

Text " contenteditable" - this is on my wish list is to eventually get autoNumeric to work here - the issue is there is no reliable method to place the caret.

$1,000.00