diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
index 884cc62d43..4a7fff99f8 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js
@@ -15,7 +15,22 @@ function textAreaController($scope, validationMessageService) {
if ($scope.model.config && $scope.model.config.maxChars) {
$scope.model.maxlength = true;
}
-
+
+ $scope.$on("formSubmitting", function() {
+ if ($scope.isLengthValid()) {
+ $scope.textareaFieldForm.textarea.$setValidity("maxChars", true);
+ } else {
+ $scope.textareaFieldForm.textarea.$setValidity("maxChars", false);
+ }
+ });
+
+ $scope.isLengthValid = function() {
+ if (!$scope.model.maxlength) {
+ return true;
+ }
+ return $scope.model.config.maxChars >= $scope.model.count;
+ }
+
$scope.model.change = function () {
if ($scope.model.value) {
$scope.model.count = $scope.model.value.length;
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
index 04bd8590d2..d255c4a5d6 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.html
@@ -10,7 +10,7 @@
+
Maximum %0% characters, %1% too many.
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
index e86d8caef4..b47c3584b3 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js
@@ -11,7 +11,19 @@ function textboxController($scope, validationMessageService) {
// if no max is specified in the config
$scope.model.config.maxChars = 500;
}
-
+
+ $scope.$on("formSubmitting", function() {
+ if ($scope.isLengthValid()) {
+ $scope.textboxFieldForm.textbox.$setValidity("maxChars", true);
+ } else {
+ $scope.textboxFieldForm.textbox.$setValidity("maxChars", false);
+ }
+ });
+
+ $scope.isLengthValid = function() {
+ return $scope.model.config.maxChars >= $scope.model.count;
+ }
+
$scope.model.change = function () {
if ($scope.model.value) {
$scope.model.count = $scope.model.value.length;
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
index e1f5dac733..5d86259e93 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html
@@ -19,7 +19,7 @@
{{model.label}} %0% characters left.
%0% characters left.
-
+
{{model.label}} Maximum %0% characters, %1% too many.
Maximum %0% characters, %1% too many.