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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 656 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive