diff --git a/ayanova/src/api/gzvalidate.js b/ayanova/src/api/gzvalidate.js index ded5163c..6d101807 100644 --- a/ayanova/src/api/gzvalidate.js +++ b/ayanova/src/api/gzvalidate.js @@ -224,7 +224,7 @@ export default { //CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDE DATA ATTRIBUTES ETC if (v.$gzdevmode()) { //make sure serverErrors is defined on data - if (!v$_.has(v, "serverError")) { + if (!v.$_.has(v, "serverError")) { throw "DEV ERROR gzvalidate::ServerErrors -> serverError seems to be missing from form's vue data object"; } @@ -303,12 +303,28 @@ Here are all the API level error codes that can be returned by the API server: "ErrorAPI2201":"Required field", "ErrorAPI2202":"Length exceeded", "ErrorAPI2203":"Invalid value" + + Validation errors for fields will have a code of one of the following: + | RequiredPropertyEmpty | An AyaNova fixed rule required property value is empty | +| CustomRequiredPropertyEmpty | A user customized form property set to required has an empty value | +| RequiredPropertyMissing | Required property is missing entirely | +| LengthExceeded | A text property has more characters than are allowed. The limit will be returned in the `message` property of the validation error | +| NotUnique | A text property is required to be unique but an existing identical value was found in the database | +| StartDateMustComeBeforeEndDate | When an object requires a start and end date the start date must be earlier than the end date | +| InvalidValue | Generic error indicating an input object's property is not set correctly | +| ReferentialIntegrity | Indicates modifying the object (usually a delete) will break the link to other records in the database. The other records need to be modified before continuing | +| InvalidOperation | Indicates the operation is invalid, details provided in the `message` | +| NotChangeable | Indicates the attempted property change is invalid because the value is fixed and cannot be changed | + */ var ret = []; + +return ret; + //check for errors if we have any errors if (!v.$_.isEmpty(v.serverError)) { - debugger; + //debugger; //First let's get the top level error code var apiErrorCode = parseInt(v.serverError.code); @@ -331,7 +347,12 @@ Here are all the API level error codes that can be returned by the API server: var errorsForField= v.$_.where(v.serverError.details, {target: ref}); if(errorsForField.length>0){ //iterate the errorsForField objects, build a return message for each error separated by a newline and Bob's your lobster - + v.$_.each(errorsForField,function(ve){ + var err=""; + if(ve.message){ + err=err+ve.message; + } + }) } } else {