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.5.x (untested)
Version 8.4.x (untested)
Version 8.3.x (untested)
Version 8.2.x (untested)
Version 8.1.x (untested)
Version 8.0.x (untested)
Version 7.15.x (untested)
Version 7.14.x (untested)
Version 7.13.x (untested)
Version 7.12.x (untested)
Version 7.11.x (untested)
Version 7.10.x (untested)
Version 7.9.x (untested)
Version 7.8.x (untested)
Version 7.7.x (untested)
Version 7.6.x (untested)
Version 7.5.x (untested)
Version 7.4.x (untested)
Version 7.3.x (untested)
Version 7.2.x (untested)
Version 7.1.x (untested)
Version 7.0.x (untested)
Version 6.2.x (untested)

You must login before you can report on package compatibility.

Package Information

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