Created
April 21, 2015 14:33
-
-
Save misutowolf/8f21ce3c5ed81ccce04a to your computer and use it in GitHub Desktop.
ET Callback for Currency stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EditableText.registerCallbacks({ | |
| // Callback for editing category limit/budget. | |
| budgetCurrency: function(doc) { | |
| // Variables based on editing. | |
| var oldVal = this.oldValue; | |
| var newVal = this.newValue; | |
| // Verification: | |
| if (isNaN(newVal)) { | |
| // Reject value if not a number, don't make change. | |
| doc.limit = oldVal; | |
| } else { | |
| doc.limit = Number(newVal).toFixed(2); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment