Atozed Forums
Content handlers - Printable Version

+- Atozed Forums (
+-- Forum: Atozed Software Products (
+--- Forum: IntraWeb (
+---- Forum: English (
+----- Forum: IntraWeb General Discussion (
+----- Thread: Content handlers (/thread-1725.html)

Content handlers - dbrain23 - 06-13-2020

I am currently developing a multi-form app using templates. In my master template, I've got the following:

<div class="vertical-menu">
  <a href="/dashboard/">Dashboard</a>
  <a href="/profile/">Profile</a>
  <a href="/leaves/">Leaves</a>

In my ServerController under the initialization section:

  THandlers.Add('', '/dashboard/', TContentForm.Create(TDashboardForm));
  THandlers.Add('', '/profile/', TContentForm.Create(TProfileForm));
  THandlers.Add('', '/leaves/', TContentForm.Create(TLeavesForm));

1. Would this be a better approach compared to explicitly creating the form? 
2. When the TContentForm.Create(<formclass>) is called, does it release the previously-opened form?
3. Is the TContentForm.Create(<formclass>) instantiated in the context of the UserSession?

Hope this makes sense.

RE: Content handlers - Alexandre Machado - 06-20-2020

1. Yes, that looks good to me. personally I like the idea of having one specific address for each application form.

2. It doesn't free the previous form. You can free it using any even or you can subclass the TContentForm class and implement that behavior in your class.

3. Yes, the form is created in the same context of the existing user session.

This demo explores this concept, but doesn't use templates (it shouldn't make any difference, though)