Permalink
Browse files

Change the way the ‘required’ attribute reports errors

  • Loading branch information...
1 parent 6a629ec commit e7c05ce9c1dc91a95f481140acbed17f7297f535 @Baggz committed Mar 12, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/engines/json/attributes/required.js
@@ -1,14 +1,15 @@
/**
* Required
+ * --------------------
*/
Validation.prototype.addAttributeConstructor('required', function requiredConstructor() {
-
return function required(property, propertyValue, attributeValue, propertyAttributes, callback) {
+
if (attributeValue && isUndefined(propertyValue)) {
- return callback(true);
- } else {
- return callback();
+ this.addError();
}
- };
+ return callback();
+
+ };
});

0 comments on commit e7c05ce

Please sign in to comment.