8. Advanced Controls Manipulation
"Multiple QForms" Functionality via Custom QPanels
<< Creating a Composite Control   |   Back to Main   |   Using QControlProxies to have Non-QControls Trigger Events >>

View Source
will open in a new window
Handling "Multiple QForms" on the Same Page
Qcodo only allows each front-end "web page" to only have a maximum of one QForm class per page. Because of the many issues of managing and maintaining formstate across multiple QForms, Qcodo simply does not allow for the ability to have multiple QForms per page.

However, as the development of a Qcodo application matures, developers may find themselves wishing for this ability:
  • As QForms are initially developed for simple, single-step tasks (e.g. "Post a Comment", "Edit a Project's Name", etc.), developers may want to be able to combine these simpler QForms together onto a single, larger, more cohesive QForm, utilizing AJAX to provide for a more "Single-Page Web Application" type of architecture.
  • Moreover, developers may end up with a library of these QForms that they would want to reuse in multiple locations, thus allowing for a much better, more modularized codebase.
Fortunately, the QPanel control was specifically designed to provide this kind of "Multiple QForm" functionality. In the example below, we create a couple of custom QPanels to help with the viewing and editing of a Project and its team members. The comments in each of these custom controls explain how a custom QPanel provides similar functionality to an independent, stand-alone QForm, but also details the small differences in how the certain events need to be coded.

Next, to illustrate this point further we create a PersonEditPanel, which is based on the code generated PersonEditFormBase class.

Finally, we use a few QAjaxActions and QAjaxControlActions to tie them all together into a single-page web application.

View/Edit Example: Projects and Memberships

Please Select a Project: