From 7f463d07cc1f5e18ae047d5019961734c5d71b8e Mon Sep 17 00:00:00 2001 From: kmulder <> Date: Fri, 23 Aug 2013 22:19:04 -0700 Subject: [PATCH] #18269: Mapping localized data annotation attributes to existing attributes to support client side validation. Work Item: 18269 --- .../Mvc/DataAnnotations/LocalizedModelValidatorProvider.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Orchard/Mvc/DataAnnotations/LocalizedModelValidatorProvider.cs b/src/Orchard/Mvc/DataAnnotations/LocalizedModelValidatorProvider.cs index 436c49183..9d0e74d57 100644 --- a/src/Orchard/Mvc/DataAnnotations/LocalizedModelValidatorProvider.cs +++ b/src/Orchard/Mvc/DataAnnotations/LocalizedModelValidatorProvider.cs @@ -16,6 +16,12 @@ namespace Orchard.Mvc.DataAnnotations { { typeof(StringLengthAttribute), (attribute, t) => new LocalizedStringLengthAttribute((StringLengthAttribute)attribute, t)}, { typeof(RegularExpressionAttribute), (attribute, t) => new LocalizedRegularExpressionAttribute((RegularExpressionAttribute)attribute, t)} }; + + //Register Orchard's localized version of the validation attributes to the existing adapters. + RegisterAdapter(typeof(LocalizedRequiredAttribute), typeof(RequiredAttributeAdapter)); + RegisterAdapter(typeof(LocalizedRangeAttribute), typeof(RangeAttributeAdapter)); + RegisterAdapter(typeof(LocalizedStringLengthAttribute), typeof(StringLengthAttributeAdapter)); + RegisterAdapter(typeof(LocalizedRegularExpressionAttribute), typeof(RegularExpressionAttributeAdapter)); } protected override IEnumerable GetValidators(ModelMetadata metadata, ControllerContext context, IEnumerable attributes) {