Skip to content

flatiron/formful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Formful

Reflect HTML forms from Resourceful resources.

Warning: Formful is a very young project. You might find it's still rough around the edges. Act accordingly!

Installation

 npm install formful

Features

  • Zero-configuration HTML form generation with optional backend
  • Full Resourceful resource integration ( persistence / validation / schema )
  • Built with Twitter Bootstrap and Viewful

Online Demo

http://formful.jit.su

Usage

Define resource(s)

var resourceful = require('resourceful'),
    Creature    = resourceful.define('creature');

Creature.property('type', String, { default: "dragon" });
Creature.property('email', String, { format: "email" });
Creature.property('life', Number, { default: 10, min: 0, max: 20 });

additional API documentation for defining resources

As a stand-alone server

var formful = require('formful');
formful.createServer([Creature]).listen(8000, function () {
  console.log(' > formful server started on port 8000');
});

Here is a code example of using formful as a stand-alone server: https://github.com/flatiron/formful/blob/master/examples/server.js

Validation

Formful will respect Resourceful validation through revalidator. Not all property types and formats are fully implemented in Formful yet, but they are all coming soon.

Here is an example of trying to create a new creature without a valid email. Bad creature!

Persistence

Formful persists to data-providers using Resourceful. You can find more information about Resourceful here.

Customization of forms

As of the formful v0.1.0 release, form customization is not so awesome. This will be improved soon.

The form View is created by the viewful library and is a viewful.View instance. Viewful provides a rich set of features including support for 22 different JavaScript templating engines.

Currently, all forms and form components are stored as plain html files. Formful currently uses no templating engine. All rendering and data-binding is currently handled through a Presenter for each view. This is not ideal, and will be changing soon.

Tests

 npm test

TODO

  • Add integration tests for all browsers ( coming very soon )
  • Make isomorphic ( blocked by Viewful )
  • Full revalidator property type support ( numeric, boolean, array, object )
  • Better Twitter Bootstrap component integration / styling
  • Replace all string concats
  • Implement Flatiron plugin / Add Flatiron example
  • Fully implement relational resources

About

reflect HTML forms from Resourceful resources

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •