1 vote

Ubolt Validation Attributes

UPDATE

Warren made a github repo so use that instead, ill be submitting my attributes to that instead. 
https://github.com/warrenbuckley/Umbraco-Validation-Attributes

 

This Package Contains 3 new validation Attributes. 

They are used to easy access validation rules from umbraco within your model. as standard the attributes fetches data from currentModels property collection. But all attributes has and overloaded constructor that takes a node id. And all now supports client validation.

  • [UmbracoRequiredField] 
  • [UmbracoRegexField]
  • [UmbracoRangeField]
Example

[UmbracoRequiredField("isRequired", UmbracoErrorMessageField = "requiredErrorMessage")]
public string Required { get; set; }

[UmbracoRegexField("regexValidation", UmbracoErrorMessageField = "regexErrorMessage")]
public string RegularExpression { get; set; }

[UmbracoRangeField(typeof(double), "rangeMinValue", "rangeMaxValue", UmbracoErrorMessageField = "rangeErrorMessage")]
public string Range { get; set; }

 

Version 1.1 

  • Model aware attributes are removed ! look att foolproff validation instead.
  • Base Validation attribute that gives easy acces to  currentpage and error messges.
  • UmbracoErrorMessageField can now be dictionaries, all your have to do is add a # infront of the alias.
  • Range attribute added that can validate either int or doubles.
  • Client validation.
Ill look into adding datetime to range validation soon.

Screenshots

Package owner

Troels Larsen

Troels Larsen

Troels has 280 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Troels Larsen
  • Created: 28/07/2013
  • Current version 1.1
  • License MIT
  • Downloads on Our: 1K