I have an old app that does something similar to this.
The app is meant to replace paper forms that can include arbitrary
pieces of information. To do this, I have a form template which defines
fields using an XML syntax, basically invoking snippets. The snippets
output various form controls specific to the field type, each containing
a variable name.
Data is persisted in form objects, each of which is linked to a
template. I use a single database field containing a JSON map of the
variable and its value.
Form templates know how to handle both input and output. So I have one
method that shows field values based on a specific form instance, and
another that accepts input for them.
I think I may have refactored this code such that the input/display
logic was on the Record field. So body.toXhtml would iterate through the
fields and display their values, while body.toForm would render input
fields for the contained XML.
Hope that helps some.
On 08/30/2012 11:26 AM, Vivek Khurana wrote: