1.2.0 • Published 5 years ago

octaform-additional v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Octaform Additional is a package that provides you a pre-set of validation. To know more about the Octaform Validation Core please check out the official documentation in https://github.com/octaform/octaform

Getting Started

Install using yarn:

yarn add octaform-additional

Or via npm:

npm install octaform-additional --save

After installed import the octaform-additional together with the Octaform and start to use:

import Octaform from 'octaform';
import validation from 'octaform-additional';

// Add the validations object into array
Octaform.validator.add([
  validation.email,
  validation.extension
])

Available validations

ValidationsDescriptionHow to use
dateGiven a date validate the format ( / | - | . | )date: MM/DD/YYYY | M/D/YY
emailOnly valid emailsemail: true
equalToRequires the field to have the same value as anotherequalTo: <HTML_Attribute or ID>
extensionOnly valid file extensions, e.g. png, jpgextension: ['png', 'jpg']
letterOnly letters is accepted [A-Z]letter: true
maxlengthDefine maxlength from textmaxlength: 12
maxsize (bytes)Define maximum upload sizemaxsize: 50000
mincheckedDefine minimum of checked checkboxesminchecked: 2
minlengthDefine minlength from textminlength: 3
numberOnly numbers is accepted [0-9]number: true
patternRequires a value in regex formatpattern: ^[0-9]+$
rangeRequire a given value rangerange: [5, 8]
requiredMake that the field be requiredrequired: true
urlRequire a valid urlurl: true
valueEqualsRequire a value to be the same as the predefinedvalueEquals: 'Dog'
valueNotEqualsDefine one value that shouldn't be equalvalueNotEquals: 'Dog'

Demo

Take a look at the validations in the demo page: https://octaform.github.io

Changelog

Check out releases

License

The MIT License (MIT)

Copyright (c) 2020 Christian Fortes