Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error message issues - with fixes #25

Open
@brianpkelley

Description

Repeating this process on a required field was creating duplicated error messages:

  1. focus field
  2. fill field
  3. blur field
  4. focus field
  5. empty field
  6. blur field
    • Error message displayed.

Fixed by changing ng-if to ng-show on ng-messages dummy element created by sfMessagesNodeHandler.

I believe the behavior is documented here by the angular team. angular/angular.js#7549 (comment)


Error messages were not being removed on autocomplete fields, I'm not sure if this is better here or in the main angular-schema-form issue list, but I only noticed it on the md-autocomplete field.

Fixed by adding a method to the messages.js file for angular-schema-form and changing the ngModel watch to use it instead of update

 var updateAsync = function( checkForErrors ) {
 $timeout( function() { update(checkForErrors); } );
 };

...

 var once = scope.$watch('ngModel',function(ngModel) {
 if (ngModel) {
 // We also listen to changes of the model via parsers and formatters.
 // This is since both the error message can change and given a pristine
 // option to not show errors the ngModel.$error might not have changed
 // but we're not pristine any more so we should change!
 ngModel.$parsers.push(function(val) { updateAsync(true); return val; });
 ngModel.$formatters.push(function(val) { updateAsync(true); return val; });
 once();
 }
 });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /