Javascript Error - can it be blocked ?

Hi All,

I’m getting the Javascript error in my App. It makes no difference to the functionality of the App, from my observations there
are no negative impacts when it occurs. It’s quite random and happens intermittently and so far I haven’t been able to fix it.

It does occur when going from one window to another but I’ve ensured all my code is in or after the shown event of the window as
many of the posts here have suggested.

I think I know the answer to this, but is there any way we can just block the error message from appearing ? It makes the app
look amateurish from the users point of view when an error message pops up randomly.

Alternatively is there any way to examine the error message and know which of my controls it refers to using …
Source: Xojo.controls[‘CMViu8TW’].object().style.left = ‘155px’;… If I knew which control it was I could fix it.

Error: Could not execute returned javascript: null is not an object (evaluating ‘Xojo.controls[‘CMViu8TW’].object().style’)
Source: Xojo.controls[‘CMViu8TW’].object().style.left = ‘155px’;
Xojo.controls[‘CMViu8TW’].refresh();
Xojo.controls[‘CMViu8TW’].object().style.top = ‘299px’;
Xojo.controls[‘CMViu8TW’].refresh();
User Details:

Many thanks for any help.

Suppressing generically all errors is not possible. Only with try catch, AFAIK.

You can send to system.debuglog each control name, and control.controlID. That is CMViu8TW here. That ID changes at every run.

But since it looks like some error in the Xojo code, it won’t be easy to intervene in the framework JavaScript code.

Among the most frequent cause of a null error, is doing stuff about the control, or other controls, in its Open event.

Prefer the WebPage Open event, which takes place when everything is already in place.

Or prefer the Shown event.

Thanks Michel, it only ever occurs at run time. I’ve never had it happen in debug mode unfortunately. I haven’t used the WebPage Open event before so will give that a go. I’ve tried searching for any control in the window with the stated .left and .top pixel positions in the hopes of finding the offending control, but strangely enough there are none that match ? Will soldier on. Thanks for your reply.