random Javascript Error

Hello Xojo Team,

we run into doubles on getting random Javascript Error like this.

Could not execute returned javascript: ‘undefined’ is not an object (evaluating ‘Xojo.controls[‘Tr7dW6mV’].setAttribute’)
Source: Xojo.controls[‘Tr7dW6mV’].setAttribute(‘width’,‘70’);
Xojo.controls[‘Tr7dW6mV’].setAttribute(‘height’,‘100’);
Xojo.controls[‘Tr7dW6mV’].editScript(3,‘var canvas = document.getElementById(\‘Tr7dW6mV_canvas\’);’,0);
Xojo.controls[‘Tr7dW6mV’].editScript(3,‘if(canvas) {’,1);
Xojo.controls[‘Tr7dW6mV’].editScript(3,‘var context = canvas.getContext(\‘2d\’);’,2);
Xojo.controls[‘Tr7dW6mV’].editScript(3,’}’,3);
Xojo.controls[‘Tr7dW6mV’].runScript(1);
Xojo.controls[‘PXxU00rq’].setAttribute(‘width’,‘70’);
Xojo.controls[‘PXxU00rq’].setAttribute(‘height’,‘100’);
Xojo.controls[‘PXxU00rq’].editScript(3,‘var canvas = document.getElementById(\‘PXxU00rq_canvas\’);’,0);
Xojo.controls[‘PXxU00rq’].editScript(3,‘if(canvas) {’,1);
Xojo.controls[‘PXxU00rq’].editScript(3,‘var context = canvas.getContext(\‘2d\’);’,2);
Xojo.controls[‘PXxU00rq’].editScript(3,’}’,3);
Xojo.controls[‘PXxU00rq’].runScript(1);
Xojo.controls[‘ZipnLLDY’].setAttribute(‘width’,‘70’);
Xojo.controls[‘ZipnLLDY’].setAttribute(‘height’,‘100’);
Xojo.controls[‘ZipnLLDY’].editScript(3,‘var canvas = document.getElementById(\‘ZipnLLDY_canvas\’);’,0);
Xojo.controls[‘ZipnLLDY’].editScript(3,‘if(canvas) {’,1);
Xojo.controls[‘ZipnLLDY’].editScript(3,‘var context = canvas.getContext(\‘2d\’);’,2);
Xojo.controls[‘ZipnLLDY’].editScript(3,’}’,3);
Xojo.controls[‘ZipnLLDY’].runScript(1);
Xojo.controls[‘Wodt1jlV’].setAttribute(‘width’,‘70’);
Xojo.controls[‘Wodt1jlV’].setAttribute(‘height’,‘100’);
Xojo.controls[‘Wodt1jlV’].editScript(3,‘var canvas = document.getElementById(\‘Wodt1jlV_canvas\’);’,0);
Xojo.controls[‘Wodt1jlV’].editScript(3,‘if(canvas) {’,1);
Xojo.controls[‘Wodt1jlV’].editScript(3,‘var context = canvas.getContext(\‘2d\’);’,2);
Xojo.controls[‘Wodt1jlV’].editScript(3,’}’,3);
Xojo.controls[‘Wodt1jlV’].runScript(1);

this error we get when xojo builds up a big webdialog, it looks like somehow the object creation is slower then the script making the styling. This error i found in an old post and also how to solve it. https://forum.xojo.com/5345-random-indiscriminate-internal-we-javascript-errors/0
But i’m a little confused why this behavior is that old and still not fixed at all. Have any other person the same problem? thanks to Bob K for the workaround maybe you can say something to the issue too.

thanks for help

Trying to manipulate controls in the open event perhaps ?

Well, I haven’t worked on any big web app projects recently so my knowledge is not up to date. That’s just the way my consulting business works. I hadn’t worked on a desktop app in 2 years now I’m doing nothing BUT desktop apps. Next month I might be back to web apps. The nature of the beast.

Are these dynamic WebDialogs or static (i.e. placed on the page at design time)? If you can get away with static you may eliminate this error but at the sacrifice of initial loading speed. The same thing with Dynamic WebContainers, you are better off having them placed at design time if you can help it simply because there is a certain time required for controls to be created before they are available.

Why isn’t it fixed? My guess is that it’s a major framework issue and the fix involves a number of things that could potentially break lot of existing code. They tend to tread cautious on things like that. And honestly, if was happening to everyone, all the time, it would be fixed sooner. It appears to be fringe cases like ours.

If you can reproduce it in a small project it goes a long way for the engineers to be abel to fix it. I was never able to show the problem in a simple project.

no there is no open event used

It’s a mix it’s a container which get attached at runtime to a webdialog, but the elements witch fails are static containt of this container.

[quote=130236:@Bob Keeney]
If you can reproduce it in a small project it goes a long way for the engineers to be abel to fix it. I was never able to show the problem in a simple project.[/quote]
same here tried it for hours, but i think it depends on how busy the whole thing is.