Dropdown resets only in dashboard

Hello everyone, I need help. I'm using the latest version of Node-Red. I want to reset the node (dropdown) after a botton click. I've tried different options. Unfortunately, the node (dropdown) is only reset in Dashboard (front end). I want to reset the dropdown in Node Red (back end) too. Can someone help me. The options I've tried are: 1- I sent an empty payload through Change Node. 2- I set msg.reset to true. 3- I sent a 0 through Change Node. 4- I have with function Node flow.set('Name' , {}); return msg; tries. Here is an example:

[
    {
        "id": "44cadde91f5b3696",
        "type": "tab",
        "label": "Dropdown",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b5400c9fd8ab03ed",
        "type": "ui_text_input",
        "z": "44cadde91f5b3696",
        "name": "",
        "label": "ID",
        "tooltip": "",
        "group": "63d3ec1f60885da1",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "ID",
        "sendOnBlur": true,
        "className": "",
        "topicType": "str",
        "x": 310,
        "y": 440,
        "wires": [
            [
                "690c06bfd454e0ac"
            ]
        ]
    },
    {
        "id": "8d317c3a0b232c25",
        "type": "ui_text_input",
        "z": "44cadde91f5b3696",
        "name": "",
        "label": "Description",
        "tooltip": "",
        "group": "63d3ec1f60885da1",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "Description",
        "sendOnBlur": true,
        "className": "",
        "topicType": "str",
        "x": 330,
        "y": 480,
        "wires": [
            [
                "690c06bfd454e0ac"
            ]
        ]
    },
    {
        "id": "690c06bfd454e0ac",
        "type": "join",
        "z": "44cadde91f5b3696",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 490,
        "y": 460,
        "wires": [
            [
                "20a3d39226ba9352",
                "0e8e4f529ca578d2"
            ]
        ]
    },
    {
        "id": "20a3d39226ba9352",
        "type": "function",
        "z": "44cadde91f5b3696",
        "name": "",
        "func": "flow.set(\"input_data\", msg.payload);\n\nconst pId = msg.payload.ID;\nconst pDesc = msg.payload.Description;\nconst pDrop = msg.payload.Drop;\n\nif((pId.length > 0) && (pDesc.length > 0) && (pDrop.length > 0)) {\n    return { enabled: true }\n} else {\n    return { enabled: false }\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 460,
        "wires": [
            [
                "71b16cad9bc9957b"
            ]
        ]
    },
    {
        "id": "71b16cad9bc9957b",
        "type": "ui_button",
        "z": "44cadde91f5b3696",
        "name": "",
        "group": "63d3ec1f60885da1",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Submit",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "input_data",
        "payloadType": "flow",
        "topic": "",
        "topicType": "str",
        "x": 800,
        "y": 460,
        "wires": [
            [
                "0eea4c6b1139f5f3",
                "0aec70d5c9810040",
                "35e108dcd9878c10"
            ]
        ]
    },
    {
        "id": "0eea4c6b1139f5f3",
        "type": "debug",
        "z": "44cadde91f5b3696",
        "name": "Output1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 960,
        "y": 460,
        "wires": []
    },
    {
        "id": "0aec70d5c9810040",
        "type": "function",
        "z": "44cadde91f5b3696",
        "name": "",
        "func": "msg.payload = \"You entered: \" + JSON.stringify(msg.payload) \nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 960,
        "y": 500,
        "wires": [
            [
                "cb828265d8940008",
                "c51e4b5614cdc012"
            ]
        ]
    },
    {
        "id": "cb828265d8940008",
        "type": "ui_text",
        "z": "44cadde91f5b3696",
        "group": "63d3ec1f60885da1",
        "order": 5,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Result:",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "x": 1120,
        "y": 500,
        "wires": []
    },
    {
        "id": "c51e4b5614cdc012",
        "type": "debug",
        "z": "44cadde91f5b3696",
        "name": "Output3",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1120,
        "y": 540,
        "wires": []
    },
    {
        "id": "2b099144ee2b335a",
        "type": "ui_dropdown",
        "z": "44cadde91f5b3696",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "63d3ec1f60885da1",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "customer1",
                "value": "1",
                "type": "str"
            },
            {
                "label": "customer2",
                "value": "2",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "Drop",
        "topicType": "str",
        "className": "",
        "x": 340,
        "y": 520,
        "wires": [
            [
                "690c06bfd454e0ac"
            ]
        ]
    },
    {
        "id": "35e108dcd9878c10",
        "type": "change",
        "z": "44cadde91f5b3696",
        "name": "reset",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 680,
        "wires": [
            [
                "2b099144ee2b335a",
                "8d317c3a0b232c25",
                "b5400c9fd8ab03ed"
            ]
        ]
    },
    {
        "id": "0e8e4f529ca578d2",
        "type": "debug",
        "z": "44cadde91f5b3696",
        "name": "Output2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 840,
        "y": 600,
        "wires": []
    },
    {
        "id": "63d3ec1f60885da1",
        "type": "ui_group",
        "name": "BeispielDropdown",
        "tab": "6f9bbf03660a0e4f",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "6f9bbf03660a0e4f",
        "type": "ui_tab",
        "name": "Dropdown",
        "icon": "dashboard",
        "order": 24,
        "disabled": false,
        "hidden": false
    }
]

in Dashboard all fields are reset (see figure)

image

In Node Red, the input texts are reset but the dropdown is not (see figure)

image

@DAD welcome to the forum!

It would be helpful if you provided a copy of your flow, or better, a simple example of the issue so people could see exactly what you are doing.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

1 Like

I've found that (If msg arrives on input, pass through to output) doesn't work as it should. Does anyone have any idea why ?
When I activate it, the new value remains in input and is not sent to output.

Can you post a simple example showing that please. Possibly just an inject node, the dropdown and a debug node.

The dropdown node doesn't loop through your reset message. It's a kind of dirty hack but how about placing a new function node in parallel which loops your reset message through?

if(msg.payload == ''){
    msg.topic = 'Drop';
    return msg;
} 
1 Like

It worked, thanks :slightly_smiling_face:

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