Description
here's my usecase:
2 date field, one for begin date, one for end date, the custom validator try to notify user the beginDate should less than endDate, and both of them are required fields.
$validators: {
beginLessThanEnd: function (v) {
// following just sample code, not real working code
var valid = beginDate < endDate
$scope.$broadcast('schemaForm.error.' + (key === 'endDateTime' ? 'beginDateTime' : 'endDateTime'), 'beginLessThanEnd', valid);
return valid;
}
}
When I set beginDate larger than endDate, it does correctly mark 2 fields with the error message I setup, when I set beginDate back to smaller date, it get both fields valid, it's good. but, if instead, I set the endDate to a larger date then the beginDate, the endDate will be valid, but the beginDate is still invalid.
The reason of these is that the beginDate field got the "undefined" value at the initial validation failure, when the endDate get larger, the beginDate is still have "undefined" modelValue (but the viewValue is what you see in browser), then it use the undefined value to check validation (inited by the "scope.$broadcast('schemaFormValidate');" call inside the schemaForm.error broadcast handler), it will result an 302 required error of tv4.
Any ideas to resolve this? I'm using the current master branch code. with angular 1.3.14