Backbone-Forms validators
A set of Backbone-Forms validators
Table of contents
Installation
bower install backbone-forms-validators
or
npm install backbone-forms-validators
Usage
RequireJS
Add packages to config file:
packages: name: 'backbone-forms-validators' location: 'bower_components/backbone-forms-validators' main: 'bbf-validators'
Use:
define'backbone-forms-validators' 'backbone-forms-validators/pl' { // Your code}
Vanilla JS
<!-- Rest od code -->
Webpack
// Rest of code
Validators
multiple
var form = schema: emails: type: 'Text' validators: type: 'multiple' base_type: 'email' separator: ',' message: 'Emails separated by colon' ;
phone
Validates phone number
var form = schema: phone: type: 'Text' validators: 'phone' ;
minlength
Validates length of entered text
var form = schema: text: type: 'Text' validators: type: 'minlength' minlength: 3 ;
maxlength
Validates length of entered text
var form = schema: text: type: 'Text' validators: type: 'maxlength' maxlength: 9 ;
Validators PL
nip
Validates NIP (Polish tax identification number)
var form = schema: nip: type: 'Text' validators: 'nip' ;
pesel
Validates Pesel (Polish identification number)
var form = schema: pesel: type: 'Text' validators: 'pesel' ;
regon
Validates REGON (Polish Taxpayer Identification Number)
var form = schema: regon: type: 'Text' validators: 'regon' ;