Skip to content
Adam Becker edited this page Jan 19, 2014 · 6 revisions

Welcome to the formbuilder wiki!

Examples

Example 1: Creating a FormBuilder instance with predefined data

One use-case that most developers will encounter is that of the end-user building a form, saving it, leaving the page and needs to edit the same form. In other words: an edit mode of existing forms. This is done by the following snippet:

fb = new Formbuilder({
  selector: '.fb-main',
  bootstrapData: [{"field_type": "date", "required": true, "label": "Date", "field_options": {}, "cid": "date0"}]
});

The 'bootstrapData' option sets the fields that need to be preloaded. Note that the save event dumps JSON like so:

{"fields": [{"field_type": "date", "required": true, "label": "datum", "field_options": {}, "cid": "c2"}]}

So the round trip from save to load requires you to get the value for the 'fields' key.

sidebar

Clone this wiki locally