Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to view breeze client validation errors

I have read through the breeze validator information, but am not sure how to view the actual error that is occurring.

Error: client side validation errors encountered - see the entity Errors collection on this object for more detail.

I believe it's somewhere in entity.entityAspect.getValidationErrors() but am having trouble figuring out how to get the actual error out of it.

I am trying to insert a record into an entity and save changes when this error message occurs.

like image 437
user1813251 Avatar asked Jan 20 '14 14:01

user1813251


1 Answers

See :

http://www.breezejs.com/sites/all/apidocs/classes/ValidationError.html

http://www.breezejs.com/sites/all/apidocs/classes/EntityAspect.html#method_getValidationErrors

Simple example:

var errors = entity.entityAspect.getValidationErrors();
errors.forEach(function(ve) {
   var errorMessage = ve.errorMessage;
   var property = ve.property;
});

To get all of the errors in an EntityManager you can use

manager.getEntities().forEach(function(entity) { 
   var errors = entity.entityAspect.getValidationErrors();
   //.. do something with the errors ..
});
like image 59
Jay Traband Avatar answered Oct 19 '22 15:10

Jay Traband