I’d like to be able to manipulate a flow variable in a template in a node-red flow.
In particular, the template is an HTML document, and in its body are a couple of lines:
`
`
that set up two buttons next to some data for a couple of rooms. The intent is that to see more information about one of these rooms, the user presses the corresponding button. Which button was pressed is communicated using a flow variable.
What I’ve tried is defining
`
function doIt(m) { flow.set(‘showMe’,m); }
`
This fails – and depending on how and where I try it, it can prevent the entire web page from loading. However,
(1) A similar line of code in a node-red function works just fine.
(2) The invocation of the doIt() function on pressing the button works. I can substitute alert(“blah blah”) for the call to flow.set() to see this.
So, what am I supposed to do to set a flow variable inside the HTML document of a template?
Many thanks!