Giter Club home page Giter Club logo

jsonform's Introduction

Build

Build Status

Example: by ID

var byID = true;
var json = $('#form_id').getJSON( byID );

Example: default

var json = $("#form_id").getJSON();

Example: by ID for legacy code

var lancamento = {
    empresa: {id: 2, name: "Teste"},
    partidas: [
        {conta: {codigo:"1.02.0002", nome: "Compras"}, natureza: "1"},
        {conta: {codigo:"1.02.0001", nome: "Banco"}, natureza: "-1"}
    ],
    description: "Teste",
    value: "125,67",
    date: "12/03/1999"
};
var byID = true;
$('#form_id').populate( lancamento, byID );

Example: by name [default]

var lancamento = {
    empresa: {id: 2, name: "Teste"},
    partidas: [
        {conta: {codigo:"1.02.0002", nome: "Compras"}, natureza: "1"},
        {conta: {codigo:"1.02.0001", nome: "Banco"}, natureza: "-1"}
    ],
    description: "Teste",
    value: "125,67",
    date: "12/03/1999"
};
$("[name='form_name'").populate(lancamento);

Testing in Browser's Console

var script = document.createElement('script');
script.onload = function() {
   var jsonFormScript = document.createElement("script");
   //source version
   jsonFormScript.src = "https://raw.github.com/milfont/jsonform/master/lib/jsonform.js";
   //minified version
   //jsonFormScript.src = "https://raw.github.com/milfont/jsonform/master/minified/jsonform.min.js";
  document.body.appendChild(jsonFormScript);
};
script.src = "https://raw.github.com/milfont/jsonform/master/vendor/jquery-1.7.1.min.js";
document.getElementsByTagName('head')[0].appendChild(script);

Running Tests:

Install nodejs and npm https://github.com/joyent/node/wiki/Installation
git clone git://github.com/milfont/jsonform.git
cd jsonform
npm install 
sudo chmod 777 testrunner
./testrunner

Contributors:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.