Thousand separator as you type

Status
Not open for further replies.

madpato

Member
Hello

I know this is not fabrik related but i have been trying to set thousands separator as you type (there are cases where there is need to type 50.000.000 and there is always a missing or an extra zero.
I do have the thousand separator implemented with number format option, but this works only after you save the record and not on the go, as i told i need to have this while typing, do you have any leads on how this can be done?.
Im pretty sure this is done with javascript, but do you have any leads on how to do it?
Tried this: http://stackoverflow.com/questions/...-thousand-seperator-to-a-number-in-javascript
But the didnt worked, maybe i did them wrong.
Any help is appreciated, Thanks.
 
I came up with this element js action: http://screencast.com/t/s7kn8eGrZP5

Code:
var formatted = ("" + this.getValue()).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, function($1) { return $1 + "." });
this.update(formatted);
Note I've applied in on blur as altering the length of the string whilst typing wasn't particularly usable
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top