Welcome Guest, Not a member yet? Register   Sign In
Letting the user design his/her own form content
#1

[eluser]echadwickb[/eluser]
I'm running into some unique form requirements on my latest project. The form itself will be used to independently reconcile financial information coming from other parts of my app. Essentially, it tallies various "financial items" to give the user a total (for that day), which should match a total from another app section.

Here's the fun part: those "financial items" will change over time.

So a) the user needs to be able to manage those items, and b) I need to preserve items that are no longer used on the form for historical purposes.

I've got the form data storage figured out: serialized array, but I haven't figured out how to keep track of active and inactive items. Here are my ideas so far.

1. Create two tables: "form_template" and "template_element". User creates a new "form_template" and adds "elements" to that template. I store the template id with the form's serialized data. When the user needs to pull up past forms, I know which fields should be displayed by getting all the elements tied to that form_template. For validation purposes, I would track each element's properties: name, type (float, int), unit value (if int), and form_subsection.

pros: actually makes sense in my head.
cons: seems like way overkill for my purposes

2. Store each form_template as an xml document, either saved in db table, or on the filesystem. I would track the same data as in option 1, but use less db resources.

pros: seems more elegant, xml is sexy
cons: I've never written or parsed xml before


Thanks to anyone who chimes in.

Chad




Theme © iAndrew 2016 - Forum software by © MyBB