Validation of forms fields.
Install nocms-validation from NPM and include it in your own build process (using Browserify, Webpack, etc).
npm install nocms-validation --save
import validation from 'nocms-validation';
validation.validate(this.state.value, 'email', this.props.required)
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 |
This repository is published using semantic-release
, with the default AngularJS Commit Message Conventions.