Template Problems

I have templates for each page in the project, but for some pages the template is being ignored completely.

Any ideas what I am doing wrong?

I would really need more details in order to say something useful about this.
If each form unit name is unique and this form HTML file has this unique name with suffix .HTML, it should load this template.

I am using the html templates that are created along with the webform so LoginPage.pas has the template LoginPage.html, and MainPage.pas has MainPage.html

It is strange as some of the forms do use the template.

I assume they are called by the script, anywhere I can check for that?

It is the form class itself that is responsible for loading the template that is associated with the form.
If a problem persists, please try to isolate this and send a sample source project with which we can reproduce this.

As usual, creating a simple application that reproduces teh result is quite often doomed to failure. However I don't mind stepping through the code to try and isolate the error as I have just done with an XData issue.

I assume that the template is retrieved from the server by the javascript app. I can't see where this is but there must be a point after TWebForm.LoadDFMValues that places the controls if a template is available. Can you point me in the right direction to find this?

Looking at the Network tab, the file is retrieved and is correct.

If you see the HTML file is loaded in the network tab, then it means the form class is loading it.
Maybe the form replaces the loaded HTML after this?
In order to investigate, we would really need something to reproduce.

how about a link to the site? it happens on the login page so you don't have to go any further

We need to see the source code and have a compiling project in order to be able to investigate.

I'll see if I can do this. It seems as if it is only the forms that load to 'body' - LoginPage and MainPage that suffer this. All sub forms, that load to a panel are fine.

I am using the code (more or less) generated by the xdata - web core wizard so the LoginPage is called from the app source TLoginPage.Display and that calls

LoginPage := TLoginPage.CreateNew(AElementId, @AfterCreate);

@brunofierens I have a sent a demo project to help@


if you add a div to index.html and use that instead of body, it works

  <div id="publishhere" style="width=100% height=100%"></div>

@brunofierens have you had a chance to look at this?

It is on the todolist. I could not yet allocate the needed time for such investigation.
I will follow up when I could allocate the time.

1 Like

Application.CreateForm creates a new runtime instance of the form as-is, i.e. without loading the template.
To create the form with associated template, use the technique as demonstrated in the demo Demo\Basics\MultiForm:

  newform := TForm2.Create(Self);
  await(TModalResult, newform.Execute);
1 Like