An open API service indexing awesome lists of open source software.

https://github.com/betaweb/formr

A fluent browser-side JavaScript form validator
https://github.com/betaweb/formr

Last synced: about 2 months ago
JSON representation

A fluent browser-side JavaScript form validator

Awesome Lists containing this project

README

          

# formr
An easy-to-use and fluent browser-side JavaScript form validator.

## Easy to install
You just have to download `formr.min.js` and add script tag into your HTML as following :
```HTML

```

## Basic example
#### JS
```JS
var form = document.forms['awesome-form']
var validator = new window.Formr(form)

validator
.required('id', 'title', 'content', 'image')
.string('title', 'content')
.number('id')
.between('id', 1, 10)
.between('title', 1, 5)
.between('content', 10, 2000)
.checked('published', true)
.image('image', ['png'])
.observe({field: 'title', validate: false}, console.log)
.submit(function (e) {
e.preventDefault()
console.log(validator.isValid())
console.log(validator.getErrors())
})
```

#### HTML
```HTML






Envoyer

```