OliverA Expert Licensed User Longtime User Jun 20, 2019 #1 The demo for B4JS works. But when I try to use B4JS, I just get a spinning circle and the Browser's console shows: ReferenceError: b4js_b4jstest is not defined TestPage.1561057241703.js:21:113 <anonymous> http://localhost:51122/Demo/TestPage/TestPage.1561057241703.js:21 Click to expand... b4jstest is the B4JS class module I created. Steps I performed: Copy ABMaterial's Template and rename main file. Add TestPage ABM Web Page class module. In BuildPage, create the following grid Code: page.AddRowsM(1,True,20,0, "").AddCells12MP(1,0,0,0,0,"") In ConnectPage, add the following code Code: Dim btnTest As ABMButton btnTest.InitializeFlat(page, "btnTest", "", "", "Test Button", "") btnTest.B4JSUniqueKey = "myb4jsid" btnTest.B4JSOnClick("B4JSTest", "toast", Null) page.Cell(1,1).AddComponent(btnTest) Add B$JSTest ABM B4JS class module with following content Code: 'Class module Sub Class_Globals ' use Public or Dim if you want to share this variable over ALL B4JS classes ' use Private if only within this class Public ABM As ABMaterial 'ignore, just to access the constants Public Page As ABMPage 'ignore, just to be able to run ABMPage B4JS functions End Sub 'Initializes the object. You can NOT add parameters to this method. 'MUST be called InitializeB4JS is automatically called when using this class Public Sub InitializeB4JS End Sub public Sub toast() Page.B4JSShowToast("1", "", "Hello World", 3000, False) End Sub #if JAVASCRIPT #End If Run ABM application in either Debug or Release mode and get unending spinning circle with the error message show above in the console log. If I comment out these two lines Code: 'btnTest.B4JSUniqueKey = "myb4jsid" 'btnTest.B4JSOnClick("B4JSTest", "toast", Null) in TestPage's ConnectPage method, the ABM application runs (and displays the lonely button). B4J version: 7.32 ABMaterial version: 4.51 Java: 8v212 and 11 I'm attaching the files that are different/new from the standard ABM Template. I've got a feeling that it is something silly on my end, I just can't see/find it. Attachments B4JSTest.zip B4JSTest.zip 8.6 KB · Views: 710
The demo for B4JS works. But when I try to use B4JS, I just get a spinning circle and the Browser's console shows: ReferenceError: b4js_b4jstest is not defined TestPage.1561057241703.js:21:113 <anonymous> http://localhost:51122/Demo/TestPage/TestPage.1561057241703.js:21 Click to expand... b4jstest is the B4JS class module I created. Steps I performed: Copy ABMaterial's Template and rename main file. Add TestPage ABM Web Page class module. In BuildPage, create the following grid Code: page.AddRowsM(1,True,20,0, "").AddCells12MP(1,0,0,0,0,"") In ConnectPage, add the following code Code: Dim btnTest As ABMButton btnTest.InitializeFlat(page, "btnTest", "", "", "Test Button", "") btnTest.B4JSUniqueKey = "myb4jsid" btnTest.B4JSOnClick("B4JSTest", "toast", Null) page.Cell(1,1).AddComponent(btnTest) Add B$JSTest ABM B4JS class module with following content Code: 'Class module Sub Class_Globals ' use Public or Dim if you want to share this variable over ALL B4JS classes ' use Private if only within this class Public ABM As ABMaterial 'ignore, just to access the constants Public Page As ABMPage 'ignore, just to be able to run ABMPage B4JS functions End Sub 'Initializes the object. You can NOT add parameters to this method. 'MUST be called InitializeB4JS is automatically called when using this class Public Sub InitializeB4JS End Sub public Sub toast() Page.B4JSShowToast("1", "", "Hello World", 3000, False) End Sub #if JAVASCRIPT #End If Run ABM application in either Debug or Release mode and get unending spinning circle with the error message show above in the console log. If I comment out these two lines Code: 'btnTest.B4JSUniqueKey = "myb4jsid" 'btnTest.B4JSOnClick("B4JSTest", "toast", Null) in TestPage's ConnectPage method, the ABM application runs (and displays the lonely button). B4J version: 7.32 ABMaterial version: 4.51 Java: 8v212 and 11 I'm attaching the files that are different/new from the standard ABM Template. I've got a feeling that it is something silly on my end, I just can't see/find it.
Harris Expert Licensed User Longtime User Jun 21, 2019 #2 What does the inspect / console of the browser say what's missing? It should state missing resources. Upvote 0
What does the inspect / console of the browser say what's missing? It should state missing resources.
OliverA Expert Licensed User Longtime User Jun 21, 2019 #3 Harris said: What does the inspect / console of the browser say what's missing? Click to expand... The only thing that seems to be missing is GET http://localhost:51122/favicon.ico [HTTP/1.1 404 Not Found 0ms] Click to expand... That is not requested when I comment out the two lines I mentioned. Upvote 0
Harris said: What does the inspect / console of the browser say what's missing? Click to expand... The only thing that seems to be missing is GET http://localhost:51122/favicon.ico [HTTP/1.1 404 Not Found 0ms] Click to expand... That is not requested when I comment out the two lines I mentioned.
OliverA Expert Licensed User Longtime User Jun 21, 2019 #4 The console also has this error message (just before the not defined error in post #1) SyntaxError: unexpected token: ':' b4js.1561083826945.js:536:20 Click to expand... and going to that line in that file there is Code: swaloptions.rtl: _b4jsthemes["msgbox-" + ThemeName].RightToLeft; Looking at the lines above that and below, I think the : should be a =, but that is generated code, not my code. I changed it to a = and now I have a running example. But why did the demo run? Hm... Upvote 0
The console also has this error message (just before the not defined error in post #1) SyntaxError: unexpected token: ':' b4js.1561083826945.js:536:20 Click to expand... and going to that line in that file there is Code: swaloptions.rtl: _b4jsthemes["msgbox-" + ThemeName].RightToLeft; Looking at the lines above that and below, I think the : should be a =, but that is generated code, not my code. I changed it to a = and now I have a running example. But why did the demo run? Hm...
OliverA Expert Licensed User Longtime User Jun 21, 2019 #5 Looking at the demo's b4js.xxxxxx.js file, that line does not exist (the swaloptions.rtl). So I did a Tools->Clean project on the Demo and now it has a spinning circle and it now has the same issue on the same line. So something is going on with the code generation for B4JS. Upvote 0
Looking at the demo's b4js.xxxxxx.js file, that line does not exist (the swaloptions.rtl). So I did a Tools->Clean project on the Demo and now it has a spinning circle and it now has the same issue on the same line. So something is going on with the code generation for B4JS.
Harris Expert Licensed User Longtime User Jun 21, 2019 #7 There are no bugs in ABM, just opportunities for feature improvements. Upvote 0