Populate text area or something similar

I made a custom node that gets some data and populates the select tag with it. For now i have 8 options. Later on i will have like 50 of them and i want to keep track of which 1 i have selected. Any idea how would i do that? Like store the values of the options in text area or something like that.The select tag allows to select multiple options. I know how to populate it with 1 option. The problem is if i select multiple options.

Not clear where the UI is - do you mean in the Node-RED Editor, Dashboard or somewhere else?

If you mean the Editor, if you have followed the instructions in the docs, the value will be persisted for you when you do a (re)deploy.

However, you are responsible for configuring the select tag so that it shows the right thing. You do that in the oneditprepare function in your node's html file.

@jake123 we've tried to point you in the right direction on this across multiple threads.

In your oneditsave function you'll have to take the list of selected options and choose someway to encode them into a node property.

In your oneditprepare function you use the same property to restore what was selected previously.

https://nodered.org/docs/creating-nodes/properties

@TotallyInformation @knolleary
I think this is pretty much a duplicate thread to How to keep data after deploying

@jake123 please dont create multiple threads for the same question. It just causes confusion.

Good point - it is pretty much identical. I'll close this thread so efforts can be focussed in the thread you've already replied in.

1 Like