Reload site after http response

Hello everyone,
I have another problem that I don't understand.
I have created a form with the following flow.
When I enter data there I get the correct answer. However, I can't get the form to reset itself after sending the data. I have already tried setting a hiddenfield and with the hiddenfield set a location.reload()
to do it... but it didn't work.
Can someone tell me how I can do this?

[
    {
        "id": "33286a393cb9bcb3",
        "type": "tab",
        "label": "testflow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "4f14f0934e33dd01",
        "type": "debug",
        "z": "33286a393cb9bcb3",
        "name": "debug 403",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 4690,
        "y": 160,
        "wires": []
    },
    {
        "id": "017c5b033569a9b3",
        "type": "template",
        "z": "33286a393cb9bcb3",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "plain",
        "template": "<html>\n    <head>\n        <title>\n            Artikel hinzufĂĽgen\n        </title>\n    </head>\n    <body>\n<form name=\"form1\" method=\"post\" action=\"\">\n  <input name=\"textfield\" type=\"text\" maxlength=\"256\">\n<button type='button'>submit</button>\n</form>\n\n</body>\n   \n</html>",
        "output": "str",
        "x": 4500,
        "y": 80,
        "wires": [
            [
                "07d82728b54e1019"
            ]
        ]
    },
    {
        "id": "e95d3fc44d6d3afc",
        "type": "http in",
        "z": "33286a393cb9bcb3",
        "name": "",
        "url": "/artikel",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 4350,
        "y": 80,
        "wires": [
            [
                "017c5b033569a9b3"
            ]
        ]
    },
    {
        "id": "07d82728b54e1019",
        "type": "http response",
        "z": "33286a393cb9bcb3",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 4630,
        "y": 80,
        "wires": []
    },
    {
        "id": "45d32a30a1616c52",
        "type": "http in",
        "z": "33286a393cb9bcb3",
        "name": "",
        "url": "/artikel",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 4450,
        "y": 160,
        "wires": [
            [
                "4f14f0934e33dd01"
            ]
        ]
    }
]

Something like this should probably work:

  const f = document.forms.form1
  f.onsubmit = function () {
    f.reset()
  }
1 Like

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