Skip to content

nocms-cms/nocms-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nocms-validation

Validation of forms fields.

semantic-release Dependency Status devDependencies

Installation

Install nocms-validation from NPM and include it in your own build process (using Browserify, Webpack, etc).

npm install nocms-validation --save

Usage

import validation from 'nocms-validation';

validation.validate(this.state.value, 'email', this.props.required)

validationRule

validationRule description
function(value) Custom function returning a boolean
'notEmpty' Check if the value is set
'email' Evaluates email addresses
'phone' Norwegian phone numbers, 8 digits with optional country code
'datetime' Matches ISO datetime YYYY-MM-DDTHH:MM, no timezone
'date' Matches ISO datetime YYYY-MM-DD
'int' Matches integer values
'orgNumber' Matches Norwegian organization numbers, 9 digits with checksum
'accountNumber' Matches Norwegian account numbers, with checksum.
'confirm' Matches booleans, used for confirmation checkboxes
'internalUri' Matches a URI to a resource on the same domain. /test
'regex' A string with a custom regex to match the value

Commit message format and publishing

This repository is published using semantic-release, with the default AngularJS Commit Message Conventions.