Actions -> getData

Get formBuilder data in json, js, or xml structure. Defaults to js. Like all actions, getData is only available after formBuilder has fully initialized.

Won't Work

var formBuilder = $(fbEditor).formBuilder();

The above pattern should be avoided for 2 reasons:

  1. At initialization formBuilder will only have the data you provided it.
  2. formBuilder loads asynchronous and actions are not immediately available.

If an action needs to be called immediately upon initialization it's recommended to use the promise property.

  • @param {String} type
  • @param {Boolean} formatted
  • @return {Array|String} formData

Correct Usage

var fbEditor = document.getElementById('build-wrap');
var formBuilder = $(fbEditor).formBuilder();

document.getElementById('getXML').addEventListener('click', function() {
document.getElementById('getJSON').addEventListener('click', function() {
    alert(formBuilder.actions.getData('json', true));
document.getElementById('getJS').addEventListener('click', function() {
    alert('check console');

See it in Action