I'm working on two separate projects now that are essentially just CMSs -- a bunch of forms for recording various bits of information. Each project is built to serve many clients, and each client seems to want to record slightly different information.
In one project we've handled this either by copying and pasting all the logic surrounding that form for each client so that we could make the changes without affecting the other clients, or we build a master form containing all possible inputs and then programmatically remove the inputs that the client doesn't want (our framework allows us to remove inputs (essentially from the 'controller') before the final template rendering). Neither solution is really clean and causes the forms to be riddled with "if" conditions based on which client we're serving.
The other project I'm just starting, and I don't want to run into the same pitfalls again, but I'm having trouble coming up with a good way to solve this problem.
I could list out all the input IDs for each form element in the database and then create a mapping between them and the clients, and then in my form template wrap each widget rendering with a check to see if the input is enabled for the current client. On the backend -- when the form is submitted -- I could save only the data that is submitted and forgo the conditionals for the most part. This creates a dependency on the IDs used in the template must match those recorded in the DB -- I don't want to create the entire form programatically as that wouldn't give me enough customizability. That's the best I can come up with.
Has anyone dealt with this sort of problem before? How did you approach it? What worked, what didn't?
For comparison, you might consider sites like Freshbooks, or Trello, or a bug tracker, or Facebook -- if any of those apps let each user customize his or her page to add or remove inputs so that they could record only the stuff they care about -- how would they manage this complexity from an architectural point of view?