How to trigger a button (Action) from another control in a Web app?

[quote=117355:@Michel Bujardet]So this which refers only to the control name could be safe ? Or should it be avoided as well ?

ExecuteJavaScript("document.getElementsByName('Button1')[0].click() ;  " )

Any code which references elements in the DOM directly, using ExecuteJavascript or otherwise, is unsupported. We reserve the right to change how we write components to the DOM at any time.

Safe? Today perhaps. Tomorrow? Who knows.

Let me put it to you this way, if you ever need help from us regarding a bug and you’ve got code like this in your project that is directly accessing the DOM, we may very well dump it back in your lap with a note that says “You did this to yourself. It’s not a bug in our framework.”

One of the reasons I harp on this is that I’ve reviewed a lot of user projects over the years and when I find code like this, I usually stop debugging and wish I’d not spent the time trying to help the person because I could have spent that time working on fixing a real bug.

[quote=117378:@Greg O’Lone]Any code which references elements in the DOM directly, using ExecuteJavascript or otherwise, is unsupported. We reserve the right to change how we write components to the DOM at any time.

Safe? Today perhaps. Tomorrow? Who knows.

Let me put it to you this way, if you ever need help from us regarding a bug and you’ve got code like this in your project that is directly accessing the DOM, we may very well dump it back in your lap with a note that says “You did this to yourself. It’s not a bug in our framework.”

One of the reasons I harp on this is that I’ve reviewed a lot of user projects over the years and when I find code like this, I usually stop debugging and wish I’d not spent the time trying to help the person because I could have spent that time working on fixing a real bug.[/quote]

Allright. I was not trying to push, I just wanted to know what was possible, as you mentioned the ‘_inner’ in a previous post as over the limit. Anything that touches the code in the DOM is off limit. Fine.

Some of us may have caught bad habits from using JavaScript in the DOM of desktop HTMLViewer or Bookmarklets in regular browsers. It then becomes difficult to distinguish the limits in web apps. Not looking for an excuse, just reflecting.

Now that I have played with WebDSK a little, and knowing that the DOM inside can be accessed, I see less of a need to do it outside.

As I showed not long ago by trying to do sprite sheets, I usually start with pure Xojo, and use JavaScript only when the first solution does not work.

As for projects containing hack code which crash as a result, I can only imagine how frustrating that can be.