diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js
index 61f7f039d9..6456001045 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js
@@ -12,27 +12,45 @@
function valPropertyMsg(serverValidationManager) {
return {
- require: ['^^form', '^^valFormManager', '^^umbProperty'],
+ require: ['^^form', '^^valFormManager', '^^umbProperty', '?^^umbVariantContent'],
replace: true,
restrict: "E",
template: "
{{errorMsg}}
",
scope: {},
link: function (scope, element, attrs, ctrl) {
+
+ var unsubscribe = [];
+ var watcher = null;
+ var hasError = false;
+ //create properties on our custom scope so we can use it in our template
+ scope.errorMsg = "";
+
+
//the property form controller api
var formCtrl = ctrl[0];
//the valFormManager controller api
var valFormManager = ctrl[1];
//the property controller api
var umbPropCtrl = ctrl[2];
+ //the variants controller api
+ var umbVariantCtrl = ctrl[3];
+
+ var currentProperty = umbPropCtrl.property;
+ scope.currentProperty = currentProperty;
+ var currentCulture = currentProperty.culture;
+ var currentVariant = umbVariantCtrl.editor.content;
+
+ // Lets check if we have variants and we are on the default language then ...
+ if(umbVariantCtrl && umbVariantCtrl.content.variants.length > 1 && !currentVariant.language.isDefault && !currentCulture && !currentProperty.unlockInvariantValue) {
+ //This property is locked cause its a invariant property shown on a non-default language.
+ //Therefor do not validate this field.
+ return;
+ }
+
+ // if we have reached this part, and there is no culture, then lets fallback to invariant. To get the validation feedback for invariant language.
+ currentCulture = currentCulture || "invariant";
- scope.currentProperty = umbPropCtrl.property;
-
- //if the property is invariant (no culture), then we will explicitly set it to the string 'invariant'
- //since this matches the value that the server will return for an invariant property.
- var currentCulture = scope.currentProperty.culture || "invariant";
-
- var watcher = null;
// Gets the error message to display
function getErrorMsg() {
@@ -138,13 +156,6 @@ function valPropertyMsg(serverValidationManager) {
}
- var hasError = false;
-
- //create properties on our custom scope so we can use it in our template
- scope.errorMsg = "";
-
- var unsubscribe = [];
-
//listen for form validation changes.
//The alternative is to add a watch to formCtrl.$invalid but that would lead to many more watches then
// subscribing to this single watch.
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valserver.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valserver.directive.js
index 64e69240da..9d1a4e6b47 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valserver.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valserver.directive.js
@@ -24,15 +24,18 @@ function valServer(serverValidationManager) {
var currentProperty = umbPropCtrl.property;
var currentCulture = currentProperty.culture;
+ var currentVariant = umbVariantCtrl.editor.content;
- var currentVariant = umbVariantCtrl.content.variants.filter( (x) => x.active )[0];
-
+ // Lets check if we have variants and we are on the default language then ...
if(umbVariantCtrl && umbVariantCtrl.content.variants.length > 1 && !currentVariant.language.isDefault && !currentCulture && !currentProperty.unlockInvariantValue) {
//This property is locked cause its a invariant property shown on a non-default language.
//Therefor do not validate this field.
- return;
+ return;// do not return anyway..
}
+ // if we have reached this part, and there is no culture, then lets fallback to invariant. To get the validation feedback for invariant language.
+ currentCulture = currentCulture || "invariant";
+
var watcher = null;
var unsubscribe = [];