In the sample below, start typing 1234. Transform value should add a comma after "1". Now place the cursor right after the comma and press backspace. You'll notice the cursor jump to the end of the value.
Code:
isc.DynamicForm.create({
width: 300,
fields: [
{title:"Item", type:"text",
transformInput:function(form, item, value, oldValue){
if(value.length > 3){
var lss = value.split("");
var counter = 0;
var newValue = "";
//add commas to the left side
for(var i=lss.length-1;i>-1;i--){
if(counter==3){
newValue ="," + newValue;
counter = 0;
}
counter++;
newValue = lss[i]+newValue;
}
return newValue;
}
return value;
}
}
]
});
Comment