Evaluating Objects in Javascript Error

I’m getting a fairly repeatable Session Javascript error. It is:

[quote]Could not execute returned javascript: ‘undefined’ is not an object (evaluating ‘Xojo.controls[‘Hu6qtwbK’].setVisible’)
Source: Xojo.controls[‘Hu6qtwbK’].setVisible(true);
Xojo.controls[‘Hu6qtwbK’].refresh();[/quote]

Is there a way to evaluate what object ‘Hu6qtwbK’ is? I’m setting the visibility of a bunch of things so just looking at the visibility source code isn’t helpful. Wondering if I can narrow it down somehow.

When are you setting these visible ?

I have hundreds of objects. Not sure which ine it is since its not generating a compile error. Only a JjavaScript error.

When do you do this ?

In Open or Shown ?
As a general rule when do you do it ?
Just trying to help narrow down what might be done differently & there fore possibly the culprit
It sounds like you’re trying to possibly manipulate something that has not arrived in the browser yet - hence the control doesn’t exist & you get an error.

@Bob Keeney
If you’re using Safari or Chrome, open the developer inspector and copy some of the code to the console:

Xojo.controls[‘Hu6qtwbK’]

and press return. That should tell you the KIND of object that it was.

What Norman said :slight_smile: I was getting similar things. What I was doing was creating a page and setting things up in the Open event, but since it was a large page it was possible that data would change and there would be updates sent to the page BEFORE the shown event had fired. Make sure you dont make any changes to the page elements until after their shown event has fired. In my case the solution was easy, just register with the data service for the object in the shown event rather than the open event. But it might require other design changes.

Does this seem like a “shown” problem?

JavaScript error
Could not execute returned javascript: Cannot call method ‘object’ of undefined
Source: Xojo.controls[‘TdikWQlI’].object().style.top = ‘50%’;
Xojo.controls[‘TdikWQlI’].refresh();
Xojo.controls[‘JPox6Xga’].object().style.top = ‘50%’;
Xojo.controls[‘JPox6Xga’].refresh();

In Chrome developer console:
Xojo.controls[‘Rqfr370o’]
undefined
Xojo.controls[‘JPox6Xga’]
container {controlID: “JPox6Xga”, implementedEvents: Array[0], mEnabled: true, hasFinishedLoading: true, constructor: function…}
controlID: “JPox6Xga”
hasFinishedLoading: true
implementedEvents: Array[0]
mEnabled: true
proto: inheritance

Long life to forum archives… :slight_smile: