How can unintentional exiting of a tab be prevented?
If data has been changed while working on a tab, the user should be asked whether they want to leave the page. Which node elements can be used to achieve this?
How can unintentional exiting of a tab be prevented?
If data has been changed while working on a tab, the user should be asked whether they want to leave the page. Which node elements can be used to achieve this?
You should bear in mind that changing tabs on Dashboard is NOT changing the HTTP location. So changing tabs probably should not loose any data (I'm not sure whether it actually does).
And indeed, it does not. I tested with 2 text inputs on different tabs, entered text and changed tabs without leaving the field.
Good point.
But when the user leaves the page, he might forget that he has changed data on the previous TAB that necessarily be saved! This is because they would have to return to the original TAB and complete the work there.
I'm looking for something like this:
See here:
Yes, but if you check, you will find that the text is sent immediately. so node-red already has the message and if I reload the page, the Dashboard has already cached the value so nothing is lost.
In other words, a Node-RED dashboard is not really anything like a traditional web page.
I don't think that is possible because the update happens immediately so that would never trigger anyway.
Are you talking about the node red editor? If so then the browser should warn you that there are unsaved changes when you try to close it, and take you there if you cancel the close.
In version 4 of node red there is a blue dot on the tab header if there are unsaved changes in that tab.
Not on the Editor.
It's about using the TAB by the user, not the developer ...
Actually, it should initially be sufficient that the user cannot leave the TAB. This could be activated as soon as the data on the page is changed. And deactivated - i.e. TAB can be changed - after the data has been saved.
What node type in the dashboard are you referring to? Dashboard 1 or 2?
Dashboard 1
And the node type? Most will post their data when you change tabs I think.
Back to the basic question:
How can the user be informed that changed data on the TAB page could be lost if he leaves the page intentionally or unintentionally?
This is already possible with the simplest programmes (Nodepad, etc.).
So how can it work in Nodered with Dashboard 1?
How can one know that a user has completed entering all necessary data?
Sorry, strange point of view.
When you are working on a document on the screen, you want to save your work before you leave the application-- here with Nodered leave the TAB.
Using the example of a simple word processor, such as Nodepad, you are asked whether the file should be saved before leaving the application.
This is exactly the point!
There is no save option in the dashboard. Fields are passed to the flow as new values are entered. Try it with a Text Input node. With the default setting for the node it will send a message to the flow 300ms after you stop typing. So the data is 'saved' automatically.
I already made this clear at the beginning of this thread which seems to have been overlooked. Dashboard sends the data straight back to Node-RED as it is changed. It is not like a traditional web page.
The one exception that I can think of is the ui_form node, which does not submit until the submit button is clicked. I asked the OP what nodes he was using in order to determine whether the issue is with forms or not, but did not get a reply.
Perhaps I have reduced the facts too much in the descriptions of what is to be achieved, which may have led to it not being clear where "my" problem lies.
The behaviour of Nodered is clear: actions with nodes are executed directly and the status of the changed node is "retained". So far so good.
The core of the core here is that a table is read from a JSON file with a flow/tab. Then the editing of the table takes place.
If this modified table is not written back to the file before leaving the tab, these changes to the table are lost. Therefore the requirement to inform the user before changing the tab that data not written to the JSON file may be lost.
Perhaps this will clarify the situation and the requirement.
An additional point: Writing directly back to the JSON file is not useful, as the user should be able to save the changed table under a different name.
Are the changes sent to node red as they are entered?
How does the user indicate that the edit is complete?