Dialog window and refresh after clicking submit

Hello!

I try to create a form, when i click on submitm, a popup appears. After clicking on OK on the popup the current page should refresh. The reason why i want to refresh is, because i pre(re)fill my form with my stored values.

I cant manage to releaod the current page. Thats what i have so far

[
    {
        "id": "783e32a8e4c4730b",
        "type": "ui_ui_control",
        "z": "bb1e74244b8354b7",
        "name": "",
        "events": "all",
        "x": 100,
        "y": 760,
        "wires": [
            [
                "9177d6d439df3603"
            ]
        ]
    },
    {
        "id": "9177d6d439df3603",
        "type": "function",
        "z": "bb1e74244b8354b7",
        "name": "get SaveFormToConcept",
        "func": "msg.payload = flow.get(\"SaveFormToConcept\")\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 760,
        "wires": [
            [
                "e73bdea85f680963"
            ]
        ]
    },
    {
        "id": "e73bdea85f680963",
        "type": "function",
        "z": "bb1e74244b8354b7",
        "name": "assign to form",
        "func": "msg.payload = {\n    \"Remote\": msg.payload.Remote,\n    \"Deaerating\": msg.payload.Deaerating,\n    \"AnalogueMode\": msg.payload.AnalogueMode,\n    \"TimerMode\": msg.payload.TimerMode,\n    \"SlowMode\": msg.payload.SlowMode,\n    \"Velocity\": msg.payload.Velocity,\n    \"StartStop\": msg.payload.StartStop,\n    \"ManualSetpoint\": msg.payload.ManualSetpoint,\n\n}\nreturn msg; \n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 760,
        "wires": [
            [
                "7fcf8c03b1c476cd"
            ]
        ]
    },
    {
        "id": "7fcf8c03b1c476cd",
        "type": "ui_form",
        "z": "bb1e74244b8354b7",
        "name": "",
        "label": "",
        "group": "fa7c1f04e5714b54",
        "order": 2,
        "width": 0,
        "height": 0,
        "options": [
            {
                "label": "REMOTE (disable/enable)",
                "value": "Remote",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Deaerating",
                "value": "Deaerating",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "AnalogueMode",
                "value": "AnalogueMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "TimerMode",
                "value": "TimerMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "SlowMode",
                "value": "SlowMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Velocity",
                "value": "Velocity",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Start/Stop",
                "value": "StartStop",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "ManualSetpoint [ml/h]",
                "value": "ManualSetpoint",
                "type": "number",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "Remote": false,
            "Deaerating": false,
            "AnalogueMode": false,
            "TimerMode": false,
            "SlowMode": false,
            "Velocity": false,
            "StartStop": false,
            "ManualSetpoint": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": true,
        "className": "",
        "x": 810,
        "y": 760,
        "wires": [
            [
                "da3f9fafe27a1b42",
                "73daa829b8d79b3b",
                "d21c18e9e8122678",
                "ef0ea0a3cce1786b",
                "c88eddda1564fa27"
            ]
        ]
    },
    {
        "id": "da3f9fafe27a1b42",
        "type": "change",
        "z": "bb1e74244b8354b7",
        "name": "SaveFormToConcept",
        "rules": [
            {
                "t": "set",
                "p": "SaveFormToConcept",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1020,
        "y": 780,
        "wires": [
            [
                "e6a53b94c81d0593"
            ]
        ]
    },
    {
        "id": "e6a53b94c81d0593",
        "type": "debug",
        "z": "bb1e74244b8354b7",
        "name": "debug 39",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1260,
        "y": 780,
        "wires": []
    },
    {
        "id": "c88eddda1564fa27",
        "type": "ui_toast",
        "z": "bb1e74244b8354b7",
        "position": "dialog",
        "displayTime": "",
        "highlight": "",
        "sendall": false,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Changes saved",
        "name": "Changes saved dialog",
        "x": 940,
        "y": 1000,
        "wires": [
            [
                "b1019a19d4503230"
            ]
        ]
    },
    {
        "id": "b1019a19d4503230",
        "type": "switch",
        "z": "bb1e74244b8354b7",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "OK",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1150,
        "y": 1000,
        "wires": [
            [
                "115676cc34227345"
            ]
        ]
    },
    {
        "id": "115676cc34227345",
        "type": "template",
        "z": "bb1e74244b8354b7",
        "name": "",
        "field": "template",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "<script>\n    window.location.reload();\n</script>",
        "output": "str",
        "x": 1300,
        "y": 1000,
        "wires": [
            [
                "1cd72869b7f78f20"
            ]
        ]
    },
    {
        "id": "1cd72869b7f78f20",
        "type": "ui_template",
        "z": "bb1e74244b8354b7",
        "group": "2d4fe667.28f8ba",
        "name": "",
        "order": 10,
        "width": 0,
        "height": 0,
        "format": "",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 1460,
        "y": 1000,
        "wires": [
            []
        ]
    },
    {
        "id": "fa7c1f04e5714b54",
        "type": "ui_group",
        "name": "Write2",
        "tab": "a42d8adbe9caeb3d",
        "order": 3,
        "disp": false,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "2d4fe667.28f8ba",
        "type": "ui_group",
        "name": "demo",
        "tab": "1caa8458.b17814",
        "order": 1,
        "disp": true,
        "width": "12",
        "collapse": false
    },
    {
        "id": "a42d8adbe9caeb3d",
        "type": "ui_tab",
        "name": "Pumpe_01",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "1caa8458.b17814",
        "type": "ui_tab",
        "name": "Demo",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

I kinda manged it with a link in and out node:

here is the flow:

[
    {
        "id": "7fcf8c03b1c476cd",
        "type": "ui_form",
        "z": "bb1e74244b8354b7",
        "name": "",
        "label": "",
        "group": "fa7c1f04e5714b54",
        "order": 2,
        "width": 0,
        "height": 0,
        "options": [
            {
                "label": "REMOTE (disable/enable)",
                "value": "Remote",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Deaerating",
                "value": "Deaerating",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "AnalogueMode",
                "value": "AnalogueMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "TimerMode",
                "value": "TimerMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "SlowMode",
                "value": "SlowMode",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Velocity",
                "value": "Velocity",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "Start/Stop",
                "value": "StartStop",
                "type": "switch",
                "required": true,
                "rows": null
            },
            {
                "label": "ManualSetpoint [ml/h]",
                "value": "ManualSetpoint",
                "type": "number",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "Remote": false,
            "Deaerating": false,
            "AnalogueMode": false,
            "TimerMode": false,
            "SlowMode": false,
            "Velocity": false,
            "StartStop": false,
            "ManualSetpoint": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": true,
        "className": "",
        "x": 810,
        "y": 760,
        "wires": [
            [
                "da3f9fafe27a1b42",
                "73daa829b8d79b3b",
                "d21c18e9e8122678",
                "ef0ea0a3cce1786b",
                "f38e3ac96ce89fe4"
            ]
        ]
    },
    {
        "id": "783e32a8e4c4730b",
        "type": "ui_ui_control",
        "z": "bb1e74244b8354b7",
        "name": "",
        "events": "all",
        "x": 100,
        "y": 760,
        "wires": [
            [
                "9177d6d439df3603"
            ]
        ]
    },
    {
        "id": "e73bdea85f680963",
        "type": "function",
        "z": "bb1e74244b8354b7",
        "name": "assign to form",
        "func": "msg.payload = {\n    \"Remote\": msg.payload.Remote,\n    \"Deaerating\": msg.payload.Deaerating,\n    \"AnalogueMode\": msg.payload.AnalogueMode,\n    \"TimerMode\": msg.payload.TimerMode,\n    \"SlowMode\": msg.payload.SlowMode,\n    \"Velocity\": msg.payload.Velocity,\n    \"StartStop\": msg.payload.StartStop,\n    \"ManualSetpoint\": msg.payload.ManualSetpoint,\n\n}\nreturn msg; \n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 760,
        "wires": [
            [
                "7fcf8c03b1c476cd"
            ]
        ]
    },
    {
        "id": "e6a53b94c81d0593",
        "type": "debug",
        "z": "bb1e74244b8354b7",
        "name": "debug 39",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1260,
        "y": 780,
        "wires": []
    },
    {
        "id": "da3f9fafe27a1b42",
        "type": "change",
        "z": "bb1e74244b8354b7",
        "name": "SaveFormToConcept",
        "rules": [
            {
                "t": "set",
                "p": "SaveFormToConcept",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1020,
        "y": 780,
        "wires": [
            [
                "e6a53b94c81d0593"
            ]
        ]
    },
    {
        "id": "9177d6d439df3603",
        "type": "function",
        "z": "bb1e74244b8354b7",
        "name": "get SaveFormToConcept",
        "func": "msg.payload = flow.get(\"SaveFormToConcept\")\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 760,
        "wires": [
            [
                "e73bdea85f680963"
            ]
        ]
    },
    {
        "id": "c88eddda1564fa27",
        "type": "ui_toast",
        "z": "bb1e74244b8354b7",
        "position": "dialog",
        "displayTime": "",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Changes saved",
        "name": "Changes saved dialog",
        "x": 1220,
        "y": 820,
        "wires": [
            [
                "b1019a19d4503230"
            ]
        ]
    },
    {
        "id": "115676cc34227345",
        "type": "template",
        "z": "bb1e74244b8354b7",
        "name": "",
        "field": "template",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "<script>\n    location.reload();\n</script>",
        "output": "str",
        "x": 1520,
        "y": 820,
        "wires": [
            [
                "1cd72869b7f78f20"
            ]
        ]
    },
    {
        "id": "b1019a19d4503230",
        "type": "switch",
        "z": "bb1e74244b8354b7",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "OK",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1390,
        "y": 820,
        "wires": [
            [
                "115676cc34227345"
            ]
        ]
    },
    {
        "id": "1cd72869b7f78f20",
        "type": "ui_template",
        "z": "bb1e74244b8354b7",
        "group": "fa7c1f04e5714b54",
        "name": "",
        "order": 10,
        "width": 0,
        "height": 0,
        "format": "",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 1660,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "f38e3ac96ce89fe4",
        "type": "link out",
        "z": "bb1e74244b8354b7",
        "name": "link out 1",
        "mode": "link",
        "links": [
            "5b789b650412c368"
        ],
        "x": 945,
        "y": 820,
        "wires": []
    },
    {
        "id": "5b789b650412c368",
        "type": "link in",
        "z": "bb1e74244b8354b7",
        "name": "link in 1",
        "links": [
            "f38e3ac96ce89fe4"
        ],
        "x": 1055,
        "y": 820,
        "wires": [
            [
                "c88eddda1564fa27"
            ]
        ]
    },
    {
        "id": "fa7c1f04e5714b54",
        "type": "ui_group",
        "name": "Write2",
        "tab": "a42d8adbe9caeb3d",
        "order": 3,
        "disp": false,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "a42d8adbe9caeb3d",
        "type": "ui_tab",
        "name": "Pumpe_01",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

On akward thing appears. Has anyone an idea where is [onject object] field on my popup is coming from?

ddddddd

The [object object] is in the pop-up because that is what is in msg.payload. That field is for any other message you may want to include.

To blank it set msg.payload to a space. Apparently you have to set it to something other than blank if you want an output

1 Like

Thank you, the blank set msg.payload did it!

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