Issue when setting innerHtml of TWebPanel

After migrating from v2.1.0.2 to v2.5.4.0, setting the content my TWebPanel with a Form doesnt work anymore, im getting this error:

TypeError: Cannot set properties of null (setting 'innerHTML') at DoStatusCreate

To recreate, the form containing the TWebPanel:

unit Wrapper;

interface

uses
  System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
  WEBLib.Forms, WEBLib.Dialogs, Vcl.Menus, WEBLib.Menus,WEBLib.WebTools, Vcl.Controls, WEBLib.ExtCtrls,
  Customer, Main, Inventory, Login,WEBLib.Cookies, System.DateUtils,
  MainInsert, Help;

type
  TForm3 = class(TWebForm)
    WebMainMenu1: TWebMainMenu;
    Customer1: TMenuItem;
    Main1: TMenuItem;
    Inventory1: TMenuItem;
    MainUpdate1: TMenuItem;
    WebPanel1: TWebPanel;
    procedure setActiveForm(Sender: TObject);
    procedure Main1Click(Sender: TObject);
    procedure Main2Click(Sender: TObject);
    procedure Inventory1Click(Sender: TObject);
    function isLoggedIn(): Boolean;
  private
  public
    bearerToken: string;
    targetCustomerId: Integer;
    targetCompanyId: Integer;
  end;

var
  Form3: TForm3;
  frm: TWebForm;

implementation

{$R *.dfm}
function TForm3.isLoggedIn(): Boolean;
begin
  Form3.bearerToken := DataModule1.GetCookie('bearer');
  Result := Form3.bearerToken <> '';
end;

procedure TForm3.Inventory1Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;
 if custId.IsEmpty() and not isLoggedIn() then
 begin
//Open Customer list
 Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 end
 else
 begin
//Open Customer details
 Application.CreateForm(TForm4,WebPanel1.ElementID,frm);
 end;
end;

procedure TForm3.Main1Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;

 if custId.IsEmpty() and not isLoggedIn() then
 begin
//Open Customer list
 Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 end
 else
 begin
//Open Customer details
 Application.CreateForm(TForm1,WebPanel1.ElementID,frm);
 end;
end;
procedure TForm3.Main2Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
WriteLn('Entered');
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;

 //if custId.IsEmpty() and not isLoggedIn() then
 //begin
//Open Customer list
 //Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 //end
 //else
 //begin
//Open Customer details
 Application.CreateForm(TForm6,WebPanel1.ElementID,frm);
 //end;
end;

procedure TForm3.setActiveForm(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');

if Assigned(frm) then
begin
frm.Free;
end;
 if custId.IsEmpty() and not isLoggedIn() then
 begin
 WriteLn('Set form Login');
//Open Customer list
 Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 WriteLn('After Set form Login');
 end
 else
 begin
 WriteLn('Customer details');
//Open Customer details
 Application.CreateForm(TForm1,WebPanel1.ElementID,frm);
 end;
end;

end.

I double-checked this here again with the demo under
Demo\Basic\Formhosting but can't seen any issue with this demo. It creates a form in a TWebPanel in the same way.
If a problem persists with the latest version of TMS WEB Core, can you please isolate this and provide a sample source project with which we can reproduce the problem.

Just create a new Form unit, add a TWebPanel and set it via:

Application.CreateForm(TForm6,WebPanel1.ElementID,frm);

The form, the WebPanel and the frm var being a panel.
Just use this line and the error will pop out.

This works without any issues here:
Project1.zip (6.1 KB)

Thats very weird because I tested out your project which has the same TWebPanel setter structure but yours work but mine won't...

Could it be my source file having something missing?

program ProXERP_Web;

uses
  Vcl.Forms,
  WEBLib.Forms,
  Main in 'Main.pas' {Form1: TWebForm} {*.html},
  Customer in 'Customer.pas' {Form2: TWebForm} {*.html},
  Wrapper in 'Wrapper.pas' {Form3: TWebForm} {*.html},
  Inventory in 'Inventory.pas' {Form4: TWebForm} {*.html},
  Login in 'Login.pas' {Form5: TWebForm} {*.html},
  MainInsert in 'MainInsert.pas' {Form6: TWebForm} {*.html},
  Help in 'Help.pas' {DataModule1: TDataModule};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  Application.CreateForm(TForm5, Form5);
  Application.CreateForm(TForm6, Form6);
  Application.CreateForm(TDataModule1, DataModule1);
  Application.Run;
end.

Also see the full zipped project here @brunofierens
ProXERP_Web.zip (2.7 MB)

We have seen the issue is in the WebMainMenu component. We're investigating this. As a workaround for now, create a top aligned panel and set it as Container for the TWebMainMenu

Ok this seems to be working for now.
But after assigning my panel as the container de WebMainMenu is hidden under the web panel, any quick fix?

@brunofierens but still even after upgrading version, my TWebClientDataset can't be opened...

  1. What about creation order / z-indexes? I need details to be able to reproduce this
  2. About the TWebClientDataset, please isolate and provide a sample source project with which I can reproduce this
  1. Please check the Wrapper.pas file for the Menu and TWebPanel layout.
  2. Also see the Login.pas file for the Login button click which should open automatically the Dataset when the Connection is finished.
    ProXERP_Web.zip (2.6 MB)

@brunofierens any insight?

When I start your app, I get

I ask you to isolate this issue and strip the sample to the essential to demonstrate the problem so it can be efficiently looked at.

I am currently setting up a demo website for you to login and test, ill tell you when its 100% working so that you can check http://proxpert-demo.com/CRM/Web.html

I get:

This site can’t be reached