Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Content handlers
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.
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)

Forum Jump:

Users browsing this thread: 1 Guest(s)