WHAT'S HAPPENING?!? GeoGebra online doesn't execute javascript code at all!!!

amvukovic shared this problem 3 years ago
Not a Problem

I've uploaded onto GGB tube this applet

https://www.geogebra.org/m/fp3QN3R6

and IT SEEMS LIKE IT DOESN'T RECOGNIZE NOR EXECUTE JAVASCRIPT CODE AT ALL!!!

What's happening???


It even occurred to my mind that perhaps now you have to confirm JS usage when uploading applet... like you have to confirm if you want the reset button to be visible or not... but I didn't find that option... ?


The applet works absolutely fine offline but the minute I upload it, it doesn't work any more...


Hope this is just a bug or a temporary error...

Alex

Comments (9)

photo
1

in this lines

  1.       for(j=0;j<prviPribrojnici.length;j++) {
             ggbApplet.setListValue("prviPribrojnici",j+1,prviPribrojnici[j]);
             ggbApplet.setListValue("drugiPribrojnici",j+1,drugiPribrojnici[j]);
       }

prviPribrojnici[0] has no sense

analize the values of j

photo
1

If there would be any kind of error in code, it wouldn't work properly... which is the case offline...

EXPLANATION: In JS aray indexes begin with 0 while in GGB scripting with 1... Perhaps one may be confused because I've named the lists in the applet itself same as variables in the JS code...

So, JS array prviPribrojnici[0] = the first randomly chosen number from the JS array nizBr and JS array drugiPribrojnici[0] is the second randomly chosen number from the JS array nizBr. After that the do...while loop is called in which the procedure of choosing two random numbers from nizBr array (whose sum differs from the sum of the first two numbers) is repeated 7 times (because I want 8 pairs with different sum and the first pair is chosen at the beginning ... prviPribrojnici[0] and drugiPribrojnici[0])


So, there's no problem in JS code - it works perfectly in offline version...

photo
1

I don't see an error with https://www.geogebra.org/m/fp3QN3R6

What's the expected behaviour? How do you trigger the error?

photo
1

When you click "Pomiješaj" btn the JS global function odaberiPribrojnike() should be called / executed and the new set of the tasks-solutions pairs should be generated BUT THIS ISN'T HAPPENING!!!

So now when you end the memory THE SAME SET OF THE INITIALLY GENERATED PAIRS ARE CALLED OVER AND OVER AGAIN because the same JS global function odaberiPribrojnike() should be executed when you click the "Nova igra" button BUT THIS ALSO DOESN'T WORK!!!

Please look the post below! It's as if the JS code isn't recognized nor executed at all...


Try to download the applet and it works like a charm offline!!!

photo
1

When I run it offline I get the errors below so maybe that will help you with debugging. (Have you used non-English command names somewhere?)

(and please stop shouting)


Unknown command : Duljina

Error in JavaScript
Can't find method org.geogebra.common.plugin.GgbAPI.setListValue(string,number,org.mozilla.javascript.Undefined)

photo
1

First of all, thank you for finding the error because I was going slightly mad trying to find out what's wrong ... Of course, it's like a "system error" which I've missed from the very beginning (otherwise I wouldn't ask for a help ... at least not so desperately ...) and I've checked everything else but it never occurred to me that I forgot to write the name of a command in English!


I've created a Memory game in GeoGebra using JS several years ago but this time I wanted to finally create it completely using GGB scripting so I was using Croatian commands' names. At the end I had a problem in GGB scripting with a "do while" loop for generating task-solution pairs with different sum and that's why I've eventually used JS in that part ...


Still I think that if there's an error in code you should get error message regardless of the GeoGebra's language settings. Especially since I didn't get the same error you said you got when I've selected English in language settings this morning ... (I didn't get the first part "Unknown command: Duljina")

The user should get the error message no matter the language settings. In that sense IT STILL IS A PROBLEM and the system should have recognized the unknown command "Duljina()" because you're supposed to use only English names in JS scripting ...


In the end I honestly don't understand you attitude ... By definition the exclamation mark is a punctuation mark indicating an exclamation not shouting and, just for the record, I wasn't shouting I just spoke loudly ... Perhaps I wouldn't if I got an error message and knew what was wrong in my JS code ...


Once again thanks for your time and effort!

(I'm not shouting, I'm just using exclamation to emphasize my gratitude while I've used it previously to emphasize my despair that "there is no error" in the code but it still wasn't executing at all ...)


Best regards


Alex

photo
2

complete phrases with uppercase letters means "shouting" in the web

photo
photo
1

THERE'S DEFINITELY PROBLEM IN JS CODE EXECUTION IN ONLINE VERSION!


I've opened the GeoGebra online Classic and created a simple global JS function:


function ggbOnInit() {}
function odaberiPribrojnike() {
alert("Bokić");
}
(called within button with odaberiPribrojnike();


and got this message:


0b52853f7280acbf15cb7d5057f3c4cd

photo
1

Please post a link to that file

photo
© 2021 International GeoGebra Institute