dobtco / formbuilder

[Needs Maintainer] Formbuilder is a small graphical interface for letting users build their own webforms.
http://dobtco.github.io/formbuilder/
MIT License
1.84k stars 489 forks source link

Save JSON to HTML #155

Open laperon opened 9 years ago

laperon commented 9 years ago

Hello !

I have some questions about save Json to HTML

var builder = new Formbuilder({ selector: '#formbuilder' });

builder.on('save', function(payload){ // How to conver JSON to HTML ???? });

bencagri commented 9 years ago

Instead of saving html, saving json into some storage (mysql,mongo,file etc), is much mature. I wrote a builder for json output with php. Of course its not stable, cuz it produces html for my template. Actually its not hard to produce html output from json.

zurez commented 9 years ago

How are you sending data to server?

bencagri commented 9 years ago

For now, its not a good solution, but im sending data to hidden input inside form. Formbuilder already generates the json output. Then I set hidden inputs' value with jquery.

inside fb.on('save') method just use $('#form_input').val(payload); check this answer. https://github.com/dobtco/formbuilder/issues/154#issuecomment-90607231