angular-schema-form: Custom validator's message not showing

I have already read this issue: https://github.com/Textalk/angular-schema-form/issues/369 but my problem is quite different.

I have added a a custom validator and message to one of my form fields:

 'staff[].title': {
   key: 'staff[].title',
   validationMessage: {
     'needTitle': function() { console.log('DEBUG!'); return 'Need title';}
   },
   $validators: {
     needTitle: function (value) {
       return value ? true : false;
     }
   }
 }

When I call $scope.$broadcast(‘schemaFormValidate’); all empty required fields including staff[].title indicate that there is an error. However, the field staff[].title does not show any error message. The only way the staff[].title’s error message is show is when I type a character in that field then delete it.

Am I doing something wrong?

I am using the latest version of angular-schema-form (0.8.12).

Thanks for your help.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

Use sf-message instead of errorMessage(schemaError()). This solved the problem for me.

Documentation for sf-message can be found here: https://github.com/OptimalBPM/angular-schema-form-add-ons/blob/master/documentation/extending.md