You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be good if the widget could accept certain keystrokes and use them as multiplers. For example "2m" should be converted to two million (2000000). 3b to 3 billion, 4k to 4000, etc etc.
I imagine it could be a optional parameter like this:
I had a look at the code and this seems tricky. There's lots there to stop extraneous chars from coming into the input at all, and then other code that handles pasted values, etc. I'd like to contribute but would appreciate from pointers on changes that would be required, etc.
Another, more general approach could be to allow callbacks after the value has changed. The receiver would accept the actual numeric value, plus suffixes (and prefixes I guess) and can then compute a new number to be returned to autoNumeric. Something like:
var customHandler = function(elem, val, prefix, suffix){
// do stuff in here
// elem is the DOM element
// val has the numeric value after all stripping and unformatting
// prefix has chars stripped off the front
// suffix has the chars stripped off the end
return val * 1;
}
$('#someinput').autoNumeric({onChange: customHandler()});
It also occurs to me that this callback approach would be useful for implementing min/max values that depend on other page elements, rather than initial widget setup. There are probably many other uses.
The text was updated successfully, but these errors were encountered:
Before you jump in you may want to look at the latest version I have
been working on
(http://www.decorplanit.com/plugin/autoNumeric-1.8.0.htm). It does not
have the feature you are suggesting but has many other enhancements. I
am just finishing the documentation so the option code is not yet working.
It would be if the widget could accept certain keystrokes and use them
as multiplers. For example "2m" should be converted to two million
(2000000). 3b to 3 billion, 4k to 4000, etc etc.
These should of OFF by default. I imagine it could be a parameter like
this:
I had a look at the code and this seems tricky. There's lots there to
stop extraneous chars from coming into the input at all, and then
other code that handles pasted values, etc. I'd like to contribute but
would appreciate from pointers on changes that would be required, etc.
Another, more general approach could be to allow callbacks after the
value has changed. The receiver would accept the actual numeric value,
plus suffixes (and prefixes I guess) and can then compute a new number
to be returned to autoNumeric.
It also occurs to me that this callback approach would be useful for
implementing min/max values that depend on other page elements, rather
than initial widget setup. There are probably many other uses.
—
Reply to this email directly or view it on GitHub #10.
It would be good if the widget could accept certain keystrokes and use them as multiplers. For example "2m" should be converted to two million (2000000). 3b to 3 billion, 4k to 4000, etc etc.
I imagine it could be a optional parameter like this:
I had a look at the code and this seems tricky. There's lots there to stop extraneous chars from coming into the input at all, and then other code that handles pasted values, etc. I'd like to contribute but would appreciate from pointers on changes that would be required, etc.
Another, more general approach could be to allow callbacks after the value has changed. The receiver would accept the actual numeric value, plus suffixes (and prefixes I guess) and can then compute a new number to be returned to autoNumeric. Something like:
It also occurs to me that this callback approach would be useful for implementing min/max values that depend on other page elements, rather than initial widget setup. There are probably many other uses.
The text was updated successfully, but these errors were encountered: