Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including formulaire with all npm packages installed. Try it out:

var formulaire = require("formulaire")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

formulaire v0.0.8

form builder module





npm install formulaire

(formulaire uses lodash)

Using formulaire


var formulaire = require('formulaire');

var myForm = formulaire({

Returns cool html code ready to use

API Options

No default values (pending to do)

Option Value
formClass STRING
action STRING
method POST | GET
fieldClassWrapper STRING Equivalent class to wrapper of the field
fieldClass STRING Class definition to inputs
submit.type link | button | input
submit.clase STRING
submit.href STRING
submit.onclick STRING
submit.field STRING
field.type text | password | color | date | datetime-local | email | month | number | range | search | tel | time | url | week | radio | checkbox | select | textarea

Code Example


var formulario = formulaire({
        formClass : 'form',
        formId : 'formulario_ID',
        action: '/send',
        method: 'post',
        fieldClassWrapper: 'form-group',
        fieldClass: 'form-control',
        submit: { 
            type: 'link',
            clase: 'btn btn-primary sender',
            href: 'javascript:void(0)',
            onclick: null,
            value: 'Enviar'
        fields: {
            name: { type: 'text', required: true },
            surname: { type: 'text', required: true},
            email: { type: 'email', required: true},
            age: { type: 'number'},
            country: {
                type: 'select',
                default: 'Select your country',
                required: true,
                options: {
                    spain: { label: 'Spain', selected: true},
                    usa: { label: 'USA'}
            sex: {
                type: 'radio',
                options: {
                    m: { label: 'Male'},
                    f: { label: 'Female'}
            preferences: {
                type: 'checkbox',
                options: {
                    soccer: { label: 'Soccer', checked: true },
                    basket: { label: 'Basket'},
                    tennis: { label: 'Tennis'},
                    volley: { label: 'Volley'},
                    hockey: { label: 'Hockey'},
            observations: { type: 'textarea', required: true }

Now, you can use an JSON file to define the form

var defForm = require('./json/form_example.json');
var formulario = formulaire(defForm);


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free