https://rawb.codeplex.com/SourceControl/latest#Rawb/Rawb/js/rawb.ui.js

rawb.ManagedInput({arg, ...})

Templates: RawbManagedInputTemplate

The ManagedInput is useful for input fields which show "formatted" data except when being edited
(e.g., the "formatted" contents might show a currency symbol followed by a number with thousands
separators, while the "unformatted" contents while editing are simply an undecorated number).

Example HTML:
<!-- ko template: { name: 'RawbManagedInputTemplate', data: mi } -->
<!-- /ko -->

Example JavaScript:
var value = ko.observable();
var displayFormatter = function (value) {
    if (!isFinite(value)) return "";
    var s = value.toFixed(2);
    for (var i = s.indexOf(".") - 3; 0 < i; i -= 3)
        s = s.substr(0, i) + "," + s.substr(i);
    return "$ " + s;
};
var editFormatter = function (value) {
    return (isFinite(value) ? value.toFixed(2) : "");
},
var parser = function (input) {
    return (input != "" ? +input : undefined);
}
var mi = new rawb.ManagedInput({
    value: value,
    displayFormatter: displayFormatter,
    editFormatter: editFormatter,
    parser: parser
});
ko.applyBindings({mi: mi});

Parameters

input: observable string
Optional (default ""); exposed as observable.

The "managed" value in the input box.

value: observable any
Optional (default undefined); exposed as observable.

The underlying "unmanaged" observable.

enabled: observable boolean
Optional (default true); exposed as observable.

If true, the input field is enabled.
If false, the input field is disabled.

displayFormatter: function (value) -> string
Optional (default toString); exposed.

This function runs when the value changes and is used to format that value to update the input.
This function should never throw an exception -- in particular, it should handle falsy values.
(E.g.: formatting numbers to include thousands separators.)

editFormatter: function (value) -> string
Optional (default toString); exposed.

This function runs when the input box becomes focussed and is used to format value to update the input.
This function should never throw an exception -- in particular, it should handle falsy values.
(E.g.: formatting numbers to not include thousands separators.)

parser: function (string) -> any
Optional (default the identity function); exposed.

This function runs when the input changes and is used to update the value.
This function should never throw an exception -- in particular, it should handle falsy values.
(E.g.: formatting numbers to not include thousands separators.)

Methods

dispose(): function ()

This function clears up all subscriptions etc. created by the ManagedInput instance.
Use this when the ManagedInput instance goes out of scope, if you are concerned about potential memory leaks.