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:
> Hi!
> I am building an application where users can define there own
> "Fields" to modules. which will extend the existing modules and
> models. To explain it further, say a module has fields for First name
> and Last name. An user deploying the app can add another field call
> Address for the specific deployment to the module, whereas another
> user may add another field, say Gender, in another deployment. My
> problem here is that how do I map these added fields to lift Record
> and Mapper ? Also, how these fields can be mapped to lift forms ?
> regards
> Vivek
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code