Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Create standard JSON from Forms or populate form with json using jQuery

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 example
Octocat-spinner-32 lib
Octocat-spinner-32 minified
Octocat-spinner-32 specs
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 README.md
Octocat-spinner-32 build
Octocat-spinner-32 package.json
Octocat-spinner-32 ready.conf.js
Octocat-spinner-32 runspec.js
Octocat-spinner-32 runspecs.js
Octocat-spinner-32 testrunner
README.md

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:

Something went wrong with that request. Please try again.