formotion icon indicating copy to clipboard operation
formotion copied to clipboard

Storing settings hash

Open mattlanham opened this issue 12 years ago • 4 comments

Can you provide an example of how to store the settings hash so that it can be recalled and used as a template dynamically.

I have built an app that allows you to dynamically add field rows etc, but every time i try to save the hash it doesn't correctly store - perhaps it's just me being a Ruby noob.

I'd like to store the hash in a DB, or send it to a sever.

mattlanham avatar Feb 13 '13 15:02 mattlanham

Gah this is a really hairy problem.

The way persistence works actually doesn't support templated rows (I confirmed this morning). I spent a few hours trying to make it fit but it'll take some time to re-think how persistence should work.

Basically persistence had a core assumption that the number of rows and sections would be equal between loading and saving forms, but adding fields will mess with that...

Sorry for the delay :(

clayallsopp avatar Feb 13 '13 19:02 clayallsopp

Yikes - sounds like a pain in the ass :) keep me updated if you ever find out a way of doing it

mattlanham avatar Feb 13 '13 20:02 mattlanham

FWIW - I'd second this one. It'd be brilliant if it was possible to use Formotion to create dynamic forms, and not just static forms defined from a hash. I can appreciate the difficulty of the persistence angle, but even if the form wasn't persistent, it'd be great if I could, say, provide a block that returns the nth row of the kth section, and then still get all of the other Formotion goodness.

matthewsinclair avatar Feb 16 '13 03:02 matthewsinclair

@mattlanham Could you check out the pull request #77 and tell me if this solves your problem?

mordaroso avatar Feb 25 '13 17:02 mordaroso