Welcome to Knowage Q&A, where you can ask questions and receive answers from other members of the community.
0 votes
1 view
Hi,

I'm trying to create a HTML widget with some Javascript logic when clicking a button (changing of the background-color based on the HTML element value).

When I reload the cockpit after updating and saving the modification on my widget, I can't see anymore the ones realated to the HTML widget (the <script> and <button> tags disappear from my HTML source code).

Any suggestion?

Thanks in advance.

D. Mattia
Environment Knowage 7.1, Ubuntu 18.04
in Workspace by (300 points)

1 Answer

+1 vote

Dear D. Mattia,

unfortunately as you can read in the official documentation (https://knowage-suite.readthedocs.io/en/7.0/functionalities-guide/cockpit/index.html#html-widget), no javascript code can be used in the HTML widget for security reasons. For the same motivation dangerous tags like <button> and <script> will be deleted on save by our security filter.

To dynamically change the background of your elements, try using different kn-if tags to change the css classes, or try to apply some dynamically using a kn-column.

Thank you and regards

Davide

by (11.3k points)
Thanks for your reply.

Daniele
...