So now I'm as far as figuring out how to do this. I'm gonna think out loud and try to explain the situation.
Short info: I use Doctrine, if that would be relevant
The core of the application is to make registration forms or polls, which needs to have the ability to make custom fields/choose the fields needed. Without this capability it would be only one possible hardcoded (or several different hardcoded) form(s). So the point is to be able to define the fields needed.
I have a model called Form which has a set of attributes (or the table have fields). This is a no-brainer to do with Zend_Form, but a form in my application is not complete without one or more fields (Field model) related to it (the actual fields a user would fill inn to be registered or vote for inn a poll).
A picture to explain the database
Word definitions:
form = form in the application (Form + Field)
fields = fields in a html form (inputs, textarea, etc)
Form = Doctrine based model for meta data about a registration/poll (name,time frame, description, etc)
Field = Doctrine based model that stores info about the fields in the (required, name, small description, type, etc)
I have wondered (for when an admin create a new form with the application) if it's possible to just make a Zend_Form, that you normally would to pass on data to be persisted, for Form but just leave out the submit element and sneak inn the extra fields (Field) in the view and then send them in the same post as the Zend_Form. And then filter out the fields belonging to the Form model, persist them, thus leaving the Field data left to be persisted.
Would this work? Do you have any other solutions?
Then, for making the form that the user are going to fill out, I could try to do what iznogood suggested in the post above.
What do you guys (or girls?) suggest? I kinda rely on you to help me out here.:)
Just let me know if I need to explain more.:) I'm not sure if explained it clearly enough.
Last edited by harri (2010-06-05 00:11:39)