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.