Javascript and mobileControlDo "execute"

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
JereMiami
Posts: 11
Joined: Mon Nov 03, 2014 12:17 am

Javascript and mobileControlDo "execute"

Post by JereMiami » Sat Jun 27, 2020 6:44 pm

I've searched the forum regarding mobileControlDo "execute" and there really isn't much on here about it at all. So, I thought I would just ask.

I want to write a script that will tick a radio button on a webpage. Such as:
--
mobileControlDo sBrowserId, "execute", "document.getElementById("exampleRadioButtonId").checked = true;"
--

Is it possible? If so, what else do I have to do besides this script?

If anybody could help, many thanks in advance!

JereMiami
Posts: 11
Joined: Mon Nov 03, 2014 12:17 am

Re: Javascript and mobileControlDo "execute"

Post by JereMiami » Sun Jun 28, 2020 1:12 pm

I figured it out. For those noobs looking for an answer (noobs, like me), it does work and it works for any website that allows for it. The mobileControlDo "execute" script that contains the Javascript you want to execute simply must be in the card script along with the web browser widget code (i.e., mobileControlCreate "browser").

Example script located somewhere in the card script creating the browser widget:

on editRadio1
mobileControlDo sBrowserId, "execute", "document.getElementById('exampleButtonRadioId').checked = true"
end editRadio1

Hope this helps.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”