The MaskedTextBox widget can restrict the type of input allowed by a user.
This example demonstrates passing a single option to bind against the value of the MaskedTextBox widget.
<input data-bind="kendoMaskedTextBox: value" />
<hr/>
<div data-bind="text: value"> </div>
var ViewModel = function() {
this.value = ko.observable("test");
};
ko.applyBindings(new ViewModel());
This example demonstrates passing additional options in the data-bind attribute with value now being explicitly specified.
<input data-bind="kendoMaskedTextBox: { value: value, mask: '0,000.00 $' }" />
<hr/>
<div data-bind="text: value"> </div>
var ViewModel = function() {
this.value = ko.observable(1355.75);
};
ko.applyBindings(new ViewModel());
This example demonstrates setting global options in ko.bindingHandlers.kendoMaskedTextBox.options. This helps to simplify the markup for settings that can be used as a default for all instances of this widget.
<input data-bind="kendoMaskedTextBox: value" />
<hr/>
<div data-bind="text: value"> </div>
var ViewModel = function() {
this.value = ko.observable(1210.99);
};
ko.bindingHandlers.kendoMaskedTextBox.options = {
mask: '0,000.00 $'
};
ko.applyBindings(new ViewModel());