undefined is not an object

I was getting this error: undefined is not an object. Another post (https://forum.xojo.com/2048-evaluating-objects-in-javascript-error/0)
suggested how to identify the control. So, I knew it was a button.

What I had done was create a button on the fly. When the user returned to the page (it’s a questionnaire and users may go back and forth), the error would occur. Probably because i created another one and the first was stored in an array.

Anyway, if you get this error, look for things you’ve created locally and are possibly re-creating and/or re-using.

Hope this helps someone.

-Bob

How did you create it ?

something like

button = self.addbtnHelp()

the button was then appended to an array. And, this was inside an if (as not all the questions have help).

My solution was to create all the possible help buttons in the IDE and then set them visible/invisible as needed.

Testing is ongoing.

-Bob

OK. This method is old, undocumented, and not supported by Xojo. The error may have to do with that.

It seems to still work for now, but may break at any new version of Xojo.

Greg will probably chime in to explain why.

The recommended way today is to use a WebContainer.

Put your button on a WebContainer just the size of the button, and use http://documentation.xojo.com/index.php/WebContainer.EmbedWithin to instanciate it dynamically.

Michel,

Thanks. That’s what I (and possibly others) need to know.

-Bob