I need to load my component dinamically from json files.
I have two problems to resolve.
first:
“rules”:{
“NOMRAGSOC”:“webix.rules.isNotEmpty”
}
webix.rules.isNotEmpty does not work because json validating (the only way is to pass it as string which is not correct)
second:
how to localize while loading the ò à è characters? ( use è è …)
Maybe I was not clear: I would like to load rules from json files
Is this the solution for my first question?
webix.ajax("elements.json", function (text, data, xhr) {<br>
var m = $$('x_form');<br>
var c = webix.DataDriver.json.toObject(text);<br>
m.config.rules = c.rules;<br>
m.config.elements = c.elements;<br>
m.reconstruct();<br>
});
Never mind for my second question, I was not using an Unicode editor. Doh…
I found the solution for the first question:
webix.ajax("elements.json", function (text, data, xhr) {
var m = $$('x_form');
var c = webix.DataDriver.json.toObject(text);
m.define( "rules", c.rules );
m.config.elements = c.elements;
m.reconstruct();
});
I used “define” method for rules and it seems to work fine