How can I call a userfunction onClick with a button?
I use a button in my webapp, and I want to call a function when the button is clicked. It did not work, so I tried it again with some simple code.
The simple code that I tested on is:
And the code on the onClick of the button is:
When I click on the button, the userfunction won't run. How can I fix this?
The simple code that I tested on is:
<div>async () => {</div><div> console.log("Test"); <br>}</div>
And the code on the onClick of the button is:
await UserFunction.Test()
When I click on the button, the userfunction won't run. How can I fix this?
Tagged:
0
Answers
-
Hi,
I saw that you're trying to use `console.log` in your `UserFunction.Test`. This method prints content to the browser's console, which is suitable for viewing debug information when opening a deployed application in a browser.
If you want to display debug information on Flexpandent, you should use `Logger.i()`, which supports printing messages like strings, numbers, and more, And make sure to check 'Show debug log on the tech pendant UI' when deploying the webpage.
Thanks.
0 -
Thank you for the reply. I will use this logger in my code from now on.
It still does not fix the problem with calling the`UserFunction.Test` when I press a button. Do you have a solution for this?0 -
In Appstudio version 1.1.0, I get an error message when I press the button. the following popup will appear:
Event Trigger Error<br>
'UserFunction' not defined<br>
0
Categories
- All Categories
- 5.6K RobotStudio
- 399 UpFeed
- 20 Tutorials
- 14 RobotApps
- 301 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 830 RAPID Programming
- 13 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings