Input Components Suite Users Guide Advanced
Last Updated
19 Mar, 2007

Index

How to create your own mask definitions
Developping with IC Suite: Debug mode


How to create your own mask definitions.

//You first define your mask as a standard mask.
{ className : "timeMask",
type : "text/mask",
align : "center",
// Use 0 to fill blank spaces. Hitting del or backspace will reset the current digit to 0 in that case. blankCharacter : "0",
//Define custom mask caracters with regular expressions.
For more information about the JavaScript Regular Expressions.

maskDefinitions : {
H : /[\s0-2]/, // space or 0-2
M : /[0-5]/ // 0-5
},
//Create you masks with the letters or the signs that you want to redefine.
mask : "H#:M#",
//Provide an error message or an explication text for each redefined caracters.
//It your application needs to be internationalized,
//you can indicate "keys" and then provide translations using //IC.Dictionary.addTranslation().  These messages (or their translations) will be shown as a
//tooltip every time users type a wrong character.

maskErrors : {
H : "hourValueExpected",
M : "minuteValueExpected"
},
//(optional) Define some conditions. Any javascript code can be used.
conditions :[{
condition: function (value) {
return parseInt(value.substring(0, 2)) > 23
}, //CSS-like style definition that will be applied if the condition function returns true.
//In this case : make the text red if hour value is greater then 23.
style : { color:"red" } } ,{
condition: function (value) {
return value == "00:00"
},
style : { color:"#DDDDDD" } //Just another sample condition: text is grey for the initial "00:00" value. }] }

//Add text messages for the language that you want to cover. IC.Dictionary. addTranslation("hourValueExpected", "The first digit must contain 0,1 or 2 or stay empty"); IC.Dictionary. addTranslation("minuteValueExpected","The first munite digit must be between 0 and 5"); IC.Dictionary. addTranslation("FR_hourValueExpected","Premiere chifre d'heurs doit être 0,1,2 ou rester vide"); IC.Dictionary. addTranslation("FR_minuteValueExpected","Premiere chifre de minutes doit être entre 0 et 5");

Working with Input Components Suite in Debug mode.

ICSuite-2.x.x-custom-settings.js file contains the following setting:
    IC.Log.setShowOnError(true); //recommended for development
    IC.Log.setShowOnWarn(false); //default value
    IC.Log.setShowOnInfo(false); //default value    
It means that by default, if ICSuite detects en error in its configuration it will open a pop-up browser window with the log console with errors, warnings and info messages if there are some. By default only an error level message opens a window, however, you are free to change this. During development we recommend enabling error and warning levels. In production all three parameters should be set to false to avoid unexpected collisions. Nevertheless, you can open the log console at any time by typing in the address bar of your browse the following URL:
    javascript:void(ICOpen.Log.show())

Input Components Suite Debugger
ICS Debugger