# Template node onclick="navigate('tabname')" for multiuser

**URL:** <https://discourse.nodered.org/t/template-node-onclick-navigate-tabname-for-multiuser/62119>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [3 May 2022 12:20 UTC](https://discourse.nodered.org/t/template-node-onclick-navigate-tabname-for-multiuser/62119 "2022-05-03T12:20:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![novski](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/novski/32/23243_2.png) [@novski](https://discourse.nodered.org/u/novski)\
**Post date:** [3 May 2022 12:20 UTC](https://discourse.nodered.org/t/template-node-onclick-navigate-tabname-for-multiuser/62119/1 "2022-05-03T12:20:59Z")

</div>

I set up a working template node with a function to take me to the clicked tab.  
But now multiple users whant to use it, and we discovered that every clicking takes all open dashboards to the last clicked tab.

This is my function:

```auto
function navigate(where) {
        fetch('/navigate', {
            method: 'POST', 
            body: JSON.stringify({ tab: where }) 
        });
        return false;
    }

```

How can I prevent all other dashboards to follow to the last clicked tab?

here is a sample of that flow with one testbutton.  
`[{ "id": "884fb0cf.d68a5", "type": "ui_ui_control", "z": "97287e58.a1eed", "name": "", "events": "change", "x": 760, "y": 520, "wires": [ [] ] }, { "id": "60b9057a.631e2c", "type": "http response", "z": "97287e58.a1eed", "name": "", "statusCode": "", "headers": {}, "x": 430, "y": 480, "wires": [] }, { "id": "8145ee8e.271a", "type": "http in", "z": "97287e58.a1eed", "name": "", "url": "/navigate", "method": "post", "upload": false, "swaggerDoc": "", "x": 200, "y": 520, "wires": [[ "f9574f4.3ae91b", "60b9057a.631e2c"] ] }, { "id": "f9574f4.3ae91b", "type": "json", "z": "97287e58.a1eed", "name": "", "property": "payload", "action": "", "pretty": false, "x": 430, "y": 520, "wires": [[ "77503546.bd3d5c"] ] }, { "id": "77503546.bd3d5c", "type": "function", "z": "97287e58.a1eed", "name": "safety", "func": "return {payload: {tab: msg.payload.tab}};", "outputs": 1, "noerr": 0, "x": 590, "y": 520, "wires": [[ "884fb0cf.d68a5"] ] }, { "id": "2b293ee4d674c450", "type": "ui_template", "z": "97287e58.a1eed", "group": "43c4d7e6.ca2bf8", "name": "newtab", "order": 2, "width": "6", "height": "9", "format": "<script>\n function navigate(where) {\n fetch('/navigate', {\n method: 'POST', \n body: JSON.stringify({ tab: where }) \n });\n return false;\n }\n</script>\n<div layout=\"row\" layout-align=\"space-between\">\n <button type=\"button\" onclick=\"navigate('newtab')\"> testbutton </button>\n</div>", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": false, "templateScope": "local", "className": "", "x": 480, "y": 400, "wires": [[] ] }, { "id": "62159f39.07279", "type": "ui_ui_control", "z": "97287e58.a1eed", "name": "", "events": "all", "x": 320, "y": 320, "wires": [[ "b921c350.f679a", "2b293ee4d674c450"] ] }, { "id": "43c4d7e6.ca2bf8", "type": "ui_group", "name": "test", "tab": "cb9f47a9.877e18", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "cb9f47a9.877e18", "type": "ui_tab", "name": "newtab", "icon": "power_settings_new", "order": 1, "disabled": false, "hidden": false } ]`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 July 2022 12:21 UTC](https://discourse.nodered.org/t/template-node-onclick-navigate-tabname-for-multiuser/62119/2 "2022-07-02T12:21:47Z")

</div>

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