Hello,
I want to add a format object to a text widget after the widget is rendered:
{ view:“text”, id:“test”, value:‘12345678’, name:“f”, label:“Test”},
how do I add a format object like below to the text widget after the text widget has been rendered? I tried it with the define() function but didnt quite know how to do that. The reason for it is that the same text widget may be formatted different for one user or the other.
format:{
parse: function(a){ return a.replace(/[^0-9]*/g,""); },
edit: function(a){
function chunk(a, n){
return a.length > n ? (a.substr(0,n) + “-” + chunk(a.substr(n), n)): a;
}
return (a.length ? “+”: “”) + chunk(a, 3);
},
}
I have also tried to define the pattern property after the text widget is rendered and I cant get that to work either.
$$(“test”).define(“pattern”,"##-###-###-###");
$$(“test”).refresh();
Is there a different way the formatting of a text widget can be set after its rendered?
thanks,
Pieter