json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Broadcast schemaform.error.* broken #993

Open pvbrakel opened 5 years ago

pvbrakel commented 5 years ago

Found while upgrading to 0.8.14

Our broadcast of error messages does not work any more.

I leave formname undefined and specify a validity as true or false. $scope.$broadcast('schemaForm.error.' + fieldCode, 'payrollValidation', element.message, isValid)

The following line overwrites the given formname and assigns it the validity (bool) value. https://github.com/json-schema-form/angular-schema-form/blob/e9a2a8ccb3ac914cf0e0075b08ef6ccf9796c2a6/src/directives/sf-field.directive.js#L258

Later on the formname is checked and if it does not match (which it doesn't because is it true|false) the method returns and does nothing.

https://github.com/json-schema-form/angular-schema-form/blob/e9a2a8ccb3ac914cf0e0075b08ef6ccf9796c2a6/src/directives/sf-field.directive.js#L266

Is this a bug or am I using it wrong?