Dinamycally changing true - false

I have a default config parameter isTrue: {value:""}
On the start of my oneditprepare function i set if(node.isTrue) {node.isTrue = !node.isTrue}
On the end of my oneditsave function i set it if(node.isTrue){node.isTrue = !node.isTrue}

So basically i want when the node is opened isTrue to be set to true and when its closed i want to make it false.
The problem i get is that when i do this it changes the value only 1st time 1 open the node. Second time i open it it doesnt change the value oneditsave
Any idea why?

If you want it to be false oneditsave, just set it false

node.isTrue = false;

If you want it to toggled oneditsave, just remove the if line

node.isTrue = !node.isTrue;

The question I have is why?

I managed to do it yea. Because some websocket functions i have in my node is constantly calling even if i close the node. This way i managed to make it not call the function when the node is closed.
If i try to disable them then i get some other errors that i dont know how to fix. This way it works fine.
Only 1 problem is that i have to click 2 times on the button to unsubscribe the element.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.