0.1.0 • Published 7 years ago

@core-framework/forms v0.1.0

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

Core Framework / Forms

NPM Version build status Coveralls

About

Form definition and validation library for Core Framework.

Install

NOTE This framework is work-in-progress, please don't use it in production yet!

npm install --save @core-framework/forms

Examples

Simple form example:

let forms = require('@core-framework/forms');
let MyForm = forms.create([
    forms.field('field1', 'Bob').notEmpty(),
    forms.field('checkbox', true).checkbox()
]);

//...

let form = MyForm.createInstance(req.body);
let result = form.validate();

console.log(form.messages);
console.log(form.values);