jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

Formatter reset or re-instantiate request #10

Closed edudar closed 11 years ago

edudar commented 11 years ago

There's a special code in jQuery wrapper that prevents multiple instances of Formatter to be created which is good. The issue come when you seriously need to change pattern on the go. Typical example is credit cards one. Master Card, Visa and Discover all good with 4 groups of 4 digits. 16 total. American Express instead has 3 groups with 4, 6 and 5 digits. 15 total. Which card user types in you can get by first digit - it's 3 for Amex. Of course you can delay instantiation until user types first digit but what if he changes his mind later?

jaridmargolin commented 11 years ago

Adding a reset pattern method should not be terribly difficult. I will look into implementing this in the next release. Thanks you for your input.

SimonFricker commented 10 years ago

Can you give me a jsfiddle demo?