function
myValidatorFunc(input) {
console.log(
"VFunc: "
, input);
return
true
;
};
... [model definition] ...
complexField: {type:
"object"
,
validation: {myValidator:
function
(input) {
console.log(
"Input length: "
+ input.length)
return
myValidatorFunc(input);
}
}
I've got something like this in a grid with a custom edit template that lays out various fields. "complexField" is an array of objects, and while I'm not using fields nested inside that as actual grid columns, the custom editor seems able to bind to them. So the editor template might have among other fields, something like :
<
input
data-role
=
"numerictextbox"
data-bind
=
"value:complexField[0].intSubField1"
>
This seems to work, the binding displays and modifies "intSubField1" in element 0 of the data records "complexField" field. And the "myValidatorFunc()" function gets called for each field of the template, as expected. However, for certain fields, the "input" parameter (which is a jquery element) has length 0, instead of 1 (or greater?) - the input element that has just been tabbed out of is not being passed. So my "intSubField1" example might get passed to the validator, but for "intSubfield2" (done the same way), the valididator gets a 0-length "input" element, and I have nothing to access to do the validation.
Is there any legitimate case where a validator would get passed a zero-length "input" parameter? Could this happen if, say, there was a basic HTML5 validator like "required" set? This isn't the case here, and I would think the custom validator would just not get fired if basic validation failed first. Firing the validator with no input element to validate seems more like a bug, or lack of support for these sorts of complex bindings.
I'm trying to create an example on the dojo, but so far I can't get it to fail in a similar fashion - I'm going to keep trying to figure out what in our actual code I might not have translated to the simplistic example. We're getting this with 2016R3 and 2017R1SP1.