nodejs-model icon indicating copy to clipboard operation
nodejs-model copied to clipboard

Need help with .validate()

Open sjonesyodle opened this issue 10 years ago • 1 comments

Need help with this validator function..

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

A few things.

  • Some errors in this example. It should look like..
//Invoke validations and wait for the validations to fulfill
u1.validate(function() {
  if ( u1.isValid ) {
     //validated, perform business logic
  } else {
     //validation failed, dump validation errors to the console
     console.log(u1.errors)
  }
});

".validate" takes an argument as "filter" but does nothing with it nor invokes it as the example above illustrates.

The function does this with it..

if (filter) {
        vProps = [filter];
      }

Am I missing something?

Best, Steve

sjonesyodle avatar Nov 19 '13 16:11 sjonesyodle