Skip to content

README.md has invalid sample code for validations #10

@mattnesterenko

Description

@mattnesterenko

Took a minute to figure out why I couldn't get validations working based on the sample, but it looks like the sample code has a bug with the validation promise.

It displays this u1.validate(function() {}):

    u1.validate(function() {
      if u1.isValid {
         //validated, perform business logic
      } else {
         //validation failed, dump validation errors to the console
         console.log(p1.errors)
      }
    });

When it should call u1.validate().then(function() {}) from the validate promise:

    u1.validate().then(function() {
      if u1.isValid {
         //validated, perform business logic
      } else {
         //validation failed, dump validation errors to the console
         console.log(p1.errors)
      }
    });

Thanks,
Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions