Dynamic " text input node "

Hello friends, I have a question! I would like to add a " text input node " to my dashboard in order to
use as a time picker ( Time picker, Week picker and month picker). I read its help but I didn't understand how can I switch its mode via an arriving msg.payload!
In fact, what I intend to do is, when I push button " week " text input mode switch to week picker and the same for two other inputs(day and month).
I would appreciate it if you help me to find a sample or method.

Thanks

As far as I can tell it's not possible to change the mode via a msg.

One option would be to put the three pickers in different groups, then use ui-control to hide or show the groups when required.
This example may help

That's probably how I'd do it as well.

Alternatively I knocked up a quick template node to do this -

image

[
    {
        "id": "453b6d73626e86c5",
        "type": "debug",
        "z": "5b1aabdd384e485a",
        "name": "debug 301",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 720,
        "wires": []
    },
    {
        "id": "d7aecfe001d41412",
        "type": "ui_template",
        "z": "5b1aabdd384e485a",
        "group": "a605595c.ac6378",
        "name": "",
        "order": 20,
        "width": "6",
        "height": "5",
        "format": "<div>\n  <button onclick=\"changeInputType('week')\">Week</button>\n  <button onclick=\"changeInputType('month')\">Month</button>\n  <button onclick=\"changeInputType('time')\">Time</button>\n</div>\n\n\n<input type=\"month\" id=\"Input\" onchange=\"sendValue()\">\n\n<script>\n  var theScope = scope;\n  var input = document.getElementById(\"Input\");\n  \n  function changeInputType(type) {\n    input.type = type;\n  }\n  \n  function sendValue() {\n    var value = input.value;\n    theScope.send({ payload: value });\n  }\n</script>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 975,
        "y": 720,
        "wires": [
            [
                "453b6d73626e86c5"
            ]
        ]
    },
    {
        "id": "a605595c.ac6378",
        "type": "ui_group",
        "name": "Default",
        "tab": "78387f0f.22098",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "78387f0f.22098",
        "type": "ui_tab",
        "name": "Homex",
        "icon": "dashboard",
        "order": 25,
        "disabled": false,
        "hidden": false
    }
]

Thank you @smcgann99 , @E1cid , @TotallyInformation . I appreciate your comments.
As you suggested I will continue with adding three groups.

Have a nice weekend

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