public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { if (metadata.ContainerType != null) { if (OtherPropertyDisplayName == null) { OtherPropertyDisplayName = ModelMetadataProviders.Current.GetMetadataForProperty(() => metadata.Model, metadata.ContainerType, OtherProperty).GetDisplayName(); } } ErrorMessage = UmbracoDictionary.GetDictionaryValue("CompareError"); yield return(new ModelClientValidationEqualToRule(FormatErrorMessage(metadata.GetDisplayName()), OtherProperty)); }
public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { if (MinimumLength > 0) { ErrorMessage = UmbracoDictionary.GetDictionaryValue("MinMaxLengthError"); } else { ErrorMessage = UmbracoDictionary.GetDictionaryValue("MaxLengthError"); } yield return (new ModelClientValidationStringLengthRule(FormatErrorMessage(metadata.GetDisplayName()), MinimumLength, MaximumLength)); }
public UmbracoMaxLengthAttribute(int length, string resourceName) : base(length) { ErrorMessage = UmbracoDictionary.GetDictionaryValue(resourceName); }
public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { ErrorMessage = UmbracoDictionary.GetDictionaryValue("MaxLengthError"); yield return (new ModelClientValidationMaxLengthRule(FormatErrorMessage(metadata.GetDisplayName()), Length)); }
public UmbracoStringLengthAttribute(int maximumLength, string resourceName) : base(maximumLength) { ErrorMessage = UmbracoDictionary.GetDictionaryValue(resourceName); }
public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { ErrorMessage = UmbracoDictionary.GetDictionaryValue(ResourceName); yield return(new ModelClientValidationRequiredRule(FormatErrorMessage(metadata.GetDisplayName()))); }