public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);

            yield return
                (new ModelClientValidationMinLengthRule(FormatErrorMessage(metadata.GetDisplayName()), Length));
        }
Пример #2
0
 public UmbracoPasswordAttribute()
     : base()
 {
     ErrorMessage                      = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
     MinPasswordLengthError            = UmbracoDictionary.GetDictionaryValue(MinPasswordLengthDictionaryKey);
     MinNonAlphanumericCharactersError = UmbracoDictionary.GetDictionaryValue(MinNonAlphanumericCharactersDictionaryKey);
     PasswordStrengthError             = UmbracoDictionary.GetDictionaryValue(PasswordStrengthDictionaryKey);
 }
        public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);

            var rule = new ModelClientValidationRule()
            {
                ValidationType = "mustbetrue",
                ErrorMessage   = FormatErrorMessage(metadata.GetDisplayName()),
            };

            yield return(rule);
        }
        public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            ErrorMessageString = UmbracoDictionary.GetDictionaryValue(DictionaryKey);

            if (metadata.ContainerType != null)
            {
                if (OtherPropertyDisplayName == null)
                {
                    var otherPropertyMetadata = ModelMetadataProviders.Current.GetMetadataForProperty(() => metadata.Model, metadata.ContainerType, OtherProperty);
                    OtherPropertyDisplayName = otherPropertyMetadata.GetDisplayName();
                }
            }

            yield return(new ModelClientValidationEqualToRule(FormatErrorMessage(metadata.GetDisplayName()), OtherProperty));
        }
 public UmbracoMustBeTrueAttribute()
 {
     ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
 }
        public new IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);

            yield return(new ModelClientValidationRemoteRule(FormatErrorMessage(metadata.GetDisplayName()), this.GetUrl(context), this.HttpMethod, this.AdditionalFields));
        }