I'm writing out code for a custom item:
which is intended to be a container of FormItem objects displayed in a single text field. For example, I want an array of FloatItems. Rather than write my own isFloat validator, is there a safe way I can access:
for my own purposes? This sketch seems to work:
which is using non-obfuscated but undocumented code, but it lets me make ArrayItems like this:
Is there a better approach than what I've outlined?
Code:
isc.ClassFactory.defineClass("ArrayItem","TextItem");
Code:
_validatorDefinitions["isFloat"].condition
Code:
isc.ArrayItem.addProperties({ validators: [ { type:"custom", condition:function(item,validator,value,record){ var valid = true; for(var i=0; i<value.length; i++){ for(var v=0; v<item.memberValidators.length; v++){ var mv = item.memberValidators[v]; valid &= isc.Validator.getValidatorDefinition(mv.type).condition({},mv,value[i]); } } return valid; } } ] })
Code:
{type:"ArrayItem", memberValidators:[ {type:"integerRange", min:1, max:100} ] });