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
asked Jul 24, 2020 in Workspace by d.mattia (300 points) | 1 view

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

answered Aug 4, 2020 by redjaw (11,310 points)
Thanks for your reply.

Daniele
1,553 questions
1,017 answers
2,037 comments
2,567 users