[intro]     [up]

Class InputMask


A generic mask for input controls, allowing custom formats.
If you want to mask numbers or dates, the specialized NumberMask and DateMask are prefered, because they have the semantics for these types, allowing additional features.

Example
//Assume there are 3 inputs on the document
new InputMask(JST_MASK_NUMBERS, "numbers");
new InputMask(JST_MASK_LOWER, "lower");
var mask = new InputMask("##-####", "custom");
mask.blurFunction = function () {
    alert(this.value); //The callback is set to the input control, so 'this' is the control, not the mask
}


Constructor Arguments
Name Type Default Description
fields Field[], Field or String   The fields that compose the mask. If it's a single field, only it is used. Otherwise, if it's a String, the MaskBuilder.parse() method will be called
control HTML Input   The input to mask
keyPressFunction Function null Callback function for the keypress event
keyDownFunction Function null Callback function for the keydown event
keyUpFunction Function null Callback function for the keyup event
blurFunction Function null Callback function for the blur event
updateFunction Function null Callback function called whenever the mask is applied. The mask reference is passed on the call

Properties
blurFunction Callback function for the blur event
control The input to mask
fields The fields that compose the mask
keyDownFunction Callback function for the keydown event
keyPressFunction Callback function for the keypress event
keyUpFunction Callback function for the keyup event
updateFunction Callback function called whenever the mask is applied

Methods
update Forces the mask to be applied on the control



Properties
blurFunction
Callback function for the blur event
control
The input to mask
fields
The fields that compose the mask. If it's a single field, only it is used. Otherwise, if it's a String, the MaskBuilder.parse() method will be called
keyDownFunction
Callback function for the keydown event
keyPressFunction
Callback function for the keypress event
keyUpFunction
Callback function for the keyup event
updateFunction
Callback function called whenever the mask is applied. The mask reference is passed on the call





Methods
 
update
Forces the mask to be applied on the control