Onclick Events
I have a simple card with a Table on it where one column that has a HTML link created with a concat function. The link is to call an Azure API and I'm trying to modify the link so that it will call the API silently instead of opening a new tab each time.
I was able to play with an HTML brick and get a Javascript onclick method that worked, but when I tried to migrate that to the card it didn't do anything. It appeared to me that the "onclick" event was simply being ignored, so I simplified it to the following and confirmed that the onclick event is not firing:
concat('<a href="#" onclick="console.log(''test'');">Click Me</a>')
When I click on it, the card tries to filter instead of triggering the console log.
Am I doing something wrong, or is the onclick event ignored in this context?
Best Answer
-
The behavior you're encountering happens because Domo cards are designed to handle data and interactivity in the form of filters rather than custom JavaScript events like onclick. Custom HTML or JavaScript is often sanitized or blocked for security reasons.
Bricks are your best bet for custom scripts, but if you want to call the Azure API on user interaction, consider using Action Buttons or developing a custom app to achieve this.** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
The behavior you're encountering happens because Domo cards are designed to handle data and interactivity in the form of filters rather than custom JavaScript events like onclick. Custom HTML or JavaScript is often sanitized or blocked for security reasons.
Bricks are your best bet for custom scripts, but if you want to call the Azure API on user interaction, consider using Action Buttons or developing a custom app to achieve this.** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
For reference here's a list of things that are supported in an HTML table. JavaScript isn't supported.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Thanks to you both for the response. It seems my options are at least narrowing. I'm still learning Domo so I'm not familiar with Action Buttons. I'll look into those. It seems like that may be my last option. I'm not sure where to start with creating a custom application like this.
0 -
I just tried an HTML table with the onclick event to write the console log and it worked!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 302 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 104 SQL DataFlows
- 635 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 760 Beast Mode
- 65 App Studio
- 42 Variables
- 701 Automate
- 182 Apps
- 457 APIs & Domo Developer
- 52 Workflows
- 10 DomoAI
- 39 Predict
- 16 Jupyter Workspaces
- 23 R & Python Tiles
- 401 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 8 Software Integrations
- 132 Manage
- 129 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive