ui_iFrame disable if flow context contains exact value

Hello colleagues,

I'm trying to build some kind of switch which will enable specific ui_iFrame based on value in flow context. For example if (flow.get('agv_status') === "offline") --> disable ui_iFrame 1-3 and enable number 4.

I would appreciate your ideas how to do it.

Thank you.

You can define the iFrame directly in a template node, e.g.

<iframe id="iFrame-1" src="http://example.com" width="600" height="400" frameborder="0" title="Example iframe"></iframe>

Then in your implementation, get the iFrame object and manipulate it as you please:

const iframe1 = document.getElementById('iFrame-1');
// Now do what you want with the iFrame

Note, that if you take the status from a flow context var, this var is defined in the server, whereas the iFrame is a client object. You will need to send a message with the desired iFrame statuses to the client

Using flow context you will have to poll that in a flow and send a message to the template. It is generally preferable just to send the message to the template at the time you set the flow context, so you don't need to poll it.