octaform-additional

1.2.0 • Public • Published

Octaform
Additional validations

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

Validations Description How to use
date Given a date validate the format `( / -
email Only valid emails email: true
equalTo Requires the field to have the same value as another equalTo: <HTML_Attribute or ID>
extension Only valid file extensions, e.g. png, jpg extension: ['png', 'jpg']
letter Only letters is accepted [A-Z] letter: true
maxlength Define maxlength from text maxlength: 12
maxsize (bytes) Define maximum upload size maxsize: 50000
minchecked Define minimum of checked checkboxes minchecked: 2
minlength Define minlength from text minlength: 3
number Only numbers is accepted [0-9] number: true
pattern Requires a value in regex format pattern: ^[0-9]+$
range Require a given value range range: [5, 8]
required Make that the field be required required: true
url Require a valid url url: true
valueEquals Require a value to be the same as the predefined valueEquals: 'Dog'
valueNotEquals Define one value that shouldn't be equal valueNotEquals: '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

Package Sidebar

Install

npm i octaform-additional

Weekly Downloads

3

Version

1.2.0

License

MIT

Unpacked Size

106 kB

Total Files

21

Last publish

Collaborators

  • chrisgfortes