Olaf Schroeder wrote:
Does anybody have experience with custom-designed-forms in web apps?
How did you do it?
Is there some other technology out there that I have overlooked?

I have worked with dynamically building forms for web apps. I have a reporting app that requires the fields to be dynamically generated based on the requirements of the report. For example, one report may require a textfield and a drop-down, a second might require two drop-downs and a radio-button list. Also, some of the parameters can be pre-defined by the admin, and shouldn't be visible to the user.

The architecture I used was to define the reports and parameters in the database, as well as the parameter handlers. Then, when the page loads, it dynamically loads the parameter handlers for a given parameter.

So I have a Report and a Parameter table which defines the basics for a given form. The Parameter table defines the ID of the Handler from the ParameterHandler table. I then have ClientReport and ClientParameter tables which define the reports available for a specific client, and which parameters are to be pre-filled, and what value it will use.

The Handlers implement a ParameterHandler interface which defines how the custom control will be rendered to the user. If the particular parameter does not have a ParameterHandler defined it gets displayed as a TextBox.

The hard part was figuring how to get the values to the next step. The way I did it (and YMMV) was to have the custom handlers have a hidden textbox, and make them responsible for making sure that box has whatever value the custom control wants submitted in it. I then loop through all of the textboxes and submit the parameters as a pipe-delimitted string to the next page, which sends them off to a custom service to be handled, and ultimately show the report.

I had to write this from scratch, so I would be interested in better ways to do it as well.

Cory


_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to