Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomi77/backbone-forms-validators
A set of Backbone-Forms validators
https://github.com/tomi77/backbone-forms-validators
backbone-forms email-validation nip-validation pesel-validation phone-validation regon-validation validation validators
Last synced: 21 days ago
JSON representation
A set of Backbone-Forms validators
- Host: GitHub
- URL: https://github.com/tomi77/backbone-forms-validators
- Owner: tomi77
- License: mit
- Created: 2016-07-14T07:07:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-03T14:15:43.000Z (almost 7 years ago)
- Last Synced: 2024-12-05T05:15:33.204Z (29 days ago)
- Topics: backbone-forms, email-validation, nip-validation, pesel-validation, phone-validation, regon-validation, validation, validators
- Language: CoffeeScript
- Homepage: https://tomi77.github.io/backbone-forms-validators/index.html
- Size: 57.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Backbone-Forms validators
[![Build Status](https://travis-ci.org/tomi77/backbone-forms-validators.svg?branch=master)](https://travis-ci.org/tomi77/backbone-forms-validators)
[![Coverage Status](https://coveralls.io/repos/github/tomi77/backbone-forms-validators/badge.svg)](https://coveralls.io/github/tomi77/backbone-forms-validators)
[![Code Climate](https://codeclimate.com/github/tomi77/backbone-forms-validators/badges/gpa.svg)](https://codeclimate.com/github/tomi77/backbone-forms-validators)
[![devDependencies Status](https://david-dm.org/tomi77/backbone-forms-validators/dev-status.svg)](https://david-dm.org/tomi77/backbone-forms-validators?type=dev)
[![peerDependency Status](https://david-dm.org/tomi77/backbone-forms-validators.png)](https://david-dm.org/tomi77/backbone-forms-validators?type=peer)
![Downloads](https://img.shields.io/npm/dt/backbone-forms-validators.svg)A set of [Backbone-Forms](https://github.com/powmedia/backbone-forms) validators
## Table of contents
* [Installation](#installation)
* [Usage](#usage)
* [RequireJS](#requirejs)
* [Vanilla JS](#vanillajs)
* [Webpack](#webpack)
* [Validators](validators)
* [multiple](#multiple)
* [phone](#phone)
* [maxlength](#maxlength)
* [minlength](#minlength)
* [Validators PL](#validatorspl)
* [nip](#nip)
* [pesel](#pesel)
* [regon](#regon)## Installation
~~~bash
bower install backbone-forms-validators
~~~or
~~~bash
npm install backbone-forms-validators
~~~## Usage
### RequireJS
Add packages to config file:
~~~js
packages: [{
name: 'backbone-forms-validators',
location: 'bower_components/backbone-forms-validators',
main: 'bbf-validators'
}]
~~~Use:
~~~js
define['backbone-forms-validators', 'backbone-forms-validators/pl'], function() {
// Your code
}
~~~### Vanilla JS
~~~html
~~~
### Webpack
~~~js
require('backbone-forms-validators')
require('backbone-forms-validators/pl')// Rest of code
~~~## Validators
### multiple
~~~js
var form = new Backbone.Form({
schema: {
emails: {
type: 'Text',
validators: [{
type: 'multiple',
base_type: 'email',
separator: ',',
message: 'Emails separated by colon'
}]
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/multiple.html)
### phone
Validates phone number
~~~js
var form = new Backbone.Form({
schema: {
phone: {
type: 'Text',
validators: ['phone']
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/phone.html)
### minlength
Validates length of entered text
~~~js
var form = new Backbone.Form({
schema: {
text: {
type: 'Text',
validators: [{
type: 'minlength',
minlength: 3
}]
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/minlength.html)
### maxlength
Validates length of entered text
~~~js
var form = new Backbone.Form({
schema: {
text: {
type: 'Text',
validators: [{
type: 'maxlength',
maxlength: 9
}]
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/maxlength.html)
## Validators PL
### nip
Validates NIP (Polish tax identification number)
~~~js
var form = new Backbone.Form({
schema: {
nip: {
type: 'Text',
validators: ['nip']
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/nip.html)
### pesel
Validates Pesel (Polish identification number)
~~~js
var form = new Backbone.Form({
schema: {
pesel: {
type: 'Text',
validators: ['pesel']
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/pesel.html)
### regon
Validates REGON (Polish Taxpayer Identification Number)
~~~js
var form = new Backbone.Form({
schema: {
regon: {
type: 'Text',
validators: ['regon']
}
}
});
~~~[Demo](https://tomi77.github.io/backbone-forms-validators/regon.html)