diff --git a/package.json b/package.json index 0e5746a..4a3ae00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gpii-json-schema", - "version": "2.1.0", + "version": "2.1.1", "description": "Support validation of JSON within the Fluid and GPII ecosystems.", "main": "index.js", "scripts": { diff --git a/src/js/client/errorBinder.js b/src/js/client/errorBinder.js index 146e924..5731d64 100644 --- a/src/js/client/errorBinder.js +++ b/src/js/client/errorBinder.js @@ -11,7 +11,6 @@ https://github.com/the-t-in-rtf/gpii-json-schema/blob/master/docs/validator.md */ -/* globals fluid */ (function () { "use strict"; var gpii = fluid.registerNamespace("gpii"); @@ -38,7 +37,7 @@ invokers: { renderErrors: { funcName: "gpii.schema.client.errorAwareForm.renderErrors", - args: ["{that}", "{renderer}"] + args: ["{that}", "{renderer}"] // renderer } }, modelListeners: { @@ -77,7 +76,7 @@ var bindingPath = fluid.get(value, "path") || value; fluid.each(that.model.validationResults.errors, function (error) { if (gpii.schema.client.elPathsEqual(error.dataPath, bindingPath)) { - that.renderer.before(fieldElement, that.options.templateKeys.inlineError, error); // element, key, context + renderer.before(fieldElement, that.options.templateKeys.inlineError, error); // element, key, context } }); } diff --git a/src/js/common/schemaValidatedModelComponent.js b/src/js/common/schemaValidatedModelComponent.js index 1d44969..d7a8501 100644 --- a/src/js/common/schemaValidatedModelComponent.js +++ b/src/js/common/schemaValidatedModelComponent.js @@ -74,7 +74,13 @@ var fluid = fluid || require("infusion"); }, modelListeners: { "*": { - excludeSource: "validation", + excludeSource: ["init", "validation"], + funcName: "gpii.schema.modelComponent.validateModel", + args: ["{gpii.schema.validator}", "{that}"] // globalValidator, validatedModelComponent + } + }, + listeners: { + "onCreate.validate": { funcName: "gpii.schema.modelComponent.validateModel", args: ["{gpii.schema.validator}", "{that}"] // globalValidator, validatedModelComponent }