Bootstrap-Form-Builder icon indicating copy to clipboard operation
Bootstrap-Form-Builder copied to clipboard

Save to database & re-edit - were you sucessful?

Open qfard opened this issue 11 years ago • 7 comments

Hi,

I see in "issues" that you were trying to accomplish what I also need. I need user to save the form to database and re-edit if needed.

please let me know if you got this done.

Thanks...Q

qfard avatar May 19 '14 16:05 qfard

Hint here is that you would need to dynamically create the column whenever your form changes. If you would do this in MySQL way, you would need to call 'alter' command multiple times. My best bet is use JSON data and send system using AJAX, save your JSON data in MongoDB using your language. Since MongoDB is document oriented and JSON friendly(stored as in BSON).

huchister avatar Jun 13 '14 16:06 huchister

can you please skype me, my id is "q.fard"  it is "Q.FARD"  thank you.-----Original Message-----From: [email protected]: Fri, 13 Jun 2014 09:12:39 -0700To: [email protected]: Re: [Bootstrap-Form-Builder] Save to database & re-edit - were you sucessful? (#10)Hint here is that you would need to dynamically create the column whenever you make form change. In MySQL way, you would need to call alter multiple times and this may turns ugly. My best bet is use JSON data and send to system using AJAX, save your JSON data in MongoDB using your language. This way you won't need to worry about it.

—Reply to this email directly or view it on GitHub.

Free Online Photosharing - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!

qfard avatar Jun 13 '14 17:06 qfard

I can save it ok, and display it but since they are not objects and just HTML, I can't manipulate the fields..

do you have a working copy I can use?

my direct email is:

[email protected]

and my Skype is:

Q.Fard

Thank you.

qfard avatar Jun 13 '14 19:06 qfard

Unfortunately I don't have working copy yet, I am in the middle of process building new mechanism to support sub field set of drag and drop. In the middle of development and seeing all these code, I figured I would be better off to completely come up with my own solution base upon this. You can still use this and figure out where would be the good place to trigger the ajax query. For manipulating fields, I believe it was in assets/js/views/my-form-snippets.js on save handler function.

Coming up with new field set, you would need to manipulate json on (/data/) folder, and /template/snippet-template.js file.

huchister avatar Jun 17 '14 13:06 huchister

I found that the easiest way was to work with the original html text display panel (but keeping it hidden). That is always updated following any UI event. I simply added a new tab in to the code with a save button, etc to control when to send to database (stored the data directly as JSON to DB). This was effected by adding a JSON template at the bottom of each component snippet (wrapped in a html comment) that was then parsed when user clicks on save. Unfortunately, no success in bringing JSON back from DB and re-instituting the html state back to the formbuilder UI.

As you will be aware, backbone updates the template values automatically as you modify the UI. The 'commented out' JSON element is thus constantly available to you in a (if you choose, 'hidden') textarea that you can acquire the content of and parse. Of course, this solution is not elegant - but it did get me past the post and taught me a lot about the backbone MVC implementation.

It was a painful learning experience working with the backbone library. I did not find it particularly intuitive and am not convinced about the whole box-and-die MVC approach on the client (to me , it is overkill when you already have model and controller as java services). I am sure that to some, these words will appear as a heresy. In mitigating this statement, earlier this year, I started to use Knockout.js which is MVVM and immediately discovered an affinity with its use. It is increasingly becoming a standard part of my client side projects and, where I have the opportunity, have started to back-port some existing projects onto it. But, as they say, "horses for courses"....

Having said all of the above, I am very grateful to the author(s) of this particular Bootstrap formbuilder tool as it has saved myself and others many, many hours of otherwise quite laborious and repetitive work. Kudos to the authors...

peterb-2795 avatar Jun 19 '14 13:06 peterb-2795

Indeed, my salute also goes to those authors who were able to step ahead and build these tools for greater uses.

huchister avatar Jun 19 '14 15:06 huchister

Is there a snippet or code repo available with this mod (saving to db)?

dleffler avatar Dec 30 '14 20:12 dleffler