# Not able to prefill Form Node TIME Field

**URL:** <https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792>\
**Category:** General\
**Created:** [29 July 2022 17:30 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792 "2022-07-29T17:30:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saxenaramesh](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@saxenaramesh](https://discourse.nodered.org/u/saxenaramesh)\
**Post date:** [29 July 2022 17:30 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792/1 "2022-07-29T17:30:00Z")

</div>

I searched for this topic and found the below thread:

> [@Cannot preload Time field in Dashboard form](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465):
>
> I'm trying to preload the Time field of a node red dashboard ui form using the incoming msg, like so: [{"id":"c1dce9ca4b3f9013","type":"ui\_form","z":"30c224646f95e02b","name":"Date form","label":"","group":"903a6ab8.4f4ca8","order":1,"width":0,"height":0,"options":[{"label":"formDate","value":"formDate","type":"date","required":false,"rows":null},{"label":"formTime","value":"formTime","type":"time","required":false,"rows":null}],"formValue":{"formDate":"","formTim…

@dceejay mentioned in that thread that some solution will be available in V3.  
My node red version is v3.0.0  
Do we have some solution for this issue?  
my example flow is as below:

```auto
[
    {
        "id": "0e8399675eac0a78",
        "type": "inject",
        "z": "557e2ceff4868f83",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"date\":\"2022-07-29\",\"time\":\"22:15\"}",
        "payloadType": "json",
        "x": 550,
        "y": 1640,
        "wires": [
            [
                "e42debc79e43f9fe"
            ]
        ]
    },
    {
        "id": "e42debc79e43f9fe",
        "type": "ui_form",
        "z": "557e2ceff4868f83",
        "name": "date_time_test",
        "label": "table",
        "group": "80c78b5e6273ec34",
        "order": 4,
        "width": 17,
        "height": 1,
        "options": [
            {
                "label": "date",
                "value": "date",
                "type": "date",
                "required": true,
                "rows": null
            },
            {
                "label": "time",
                "value": "time",
                "type": "time",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "date": "",
            "time": ""
        },
        "payload": "",
        "submit": "SAVE",
        "cancel": "CANCEL",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": true,
        "className": "",
        "x": 800,
        "y": 1640,
        "wires": [
            []
        ]
    },
    {
        "id": "80c78b5e6273ec34",
        "type": "ui_group",
        "name": "test",
        "tab": "b7e619d0975936a4",
        "order": 4,
        "disp": true,
        "width": "17",
        "collapse": false,
        "className": ""
    },
    {
        "id": "b7e619d0975936a4",
        "type": "ui_tab",
        "name": "batch_entry",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

and on dashboard form, I find that date field is prefilled correctly but time field is Empty.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be7a47ba91a0c0d537966c2dc18feb570f49db92.png)

Please advise how to solve this.

Thanks.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [29 July 2022 18:03 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792/2 "2022-07-29T18:03:15Z")

</div>

It is my understanding that the date and time fields can take a ISO timestamp or a js timestamp, or part of.  
e.g.

```auto
[{"id":"0e8399675eac0a78","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":\"2022-07-29\",\"time\":6600000}","payloadType":"json","x":190,"y":1820,"wires":[["e42debc79e43f9fe"]]},{"id":"e42debc79e43f9fe","type":"ui_form","z":"30af2d3e.d94ea2","name":"date_time_test","label":"table","group":"80c78b5e6273ec34","order":4,"width":17,"height":1,"options":[{"label":"date","value":"date","type":"date","required":true,"rows":null},{"label":"time","value":"time","type":"time","required":true,"rows":null}],"formValue":{"date":"","time":""},"payload":"","submit":"SAVE","cancel":"CANCEL","topic":"topic","topicType":"msg","splitLayout":true,"className":"","x":440,"y":1820,"wires":[["452090bc.b5229"]]},{"id":"5033290f.4fdcb8","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":\"2022-07-29T00:00:00.000Z\",\"time\":\"1970-01-01T01:50:00.000Z\"}","payloadType":"json","x":160,"y":1880,"wires":[["e42debc79e43f9fe"]]},{"id":"3219fff3.989858","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":1659117548752,\"time\":1659117548752}","payloadType":"json","x":159.3333282470703,"y":1925.3333740234375,"wires":[["e42debc79e43f9fe"]]},{"id":"452090bc.b5229","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":1820,"wires":[]},{"id":"80c78b5e6273ec34","type":"ui_group","name":"test","tab":"b7e619d0975936a4","order":4,"disp":true,"width":"17","collapse":false,"className":""},{"id":"b7e619d0975936a4","type":"ui_tab","name":"batch_entry","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

```auto
{"date":"2022-07-29T00:00:00.000Z","time":"1970-01-01T01:50:00.000Z"}
or 
{"date":1659117548752,"time":6600000}
or
{"date":"2022-07-29","time":6600000}

```

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [30 July 2022 07:01 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792/3 "2022-07-30T07:01:00Z")

</div>

Yes, It Is an old unresolved issue.

I have found a workaround here [Ui\_text-input time picker not showing time in dashboard until refreshed - #17 by fmarzocca](https://discourse.nodered.org/t/ui-text-input-time-picker-not-showing-time-in-dashboard-until-refreshed/60212/17)

---

<div class="post-metadata">

**Author:** ![abesis](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@abesis](https://discourse.nodered.org/u/abesis)\
**Post date:** [30 July 2022 20:39 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792/4 "2022-07-30T20:39:46Z")

</div>

One option is to drop the Dashboard time field and use an input field in a template node. Check the code below:

```auto
[
    {
        "id": "b65d27e437f51a17",
        "type": "ui_template",
        "z": "0ed2d8ed64bef693",
        "group": "903a6ab8.4f4ca8",
        "name": "time input",
        "order": 1,
        "width": "0",
        "height": "0",
        "format": "<!DOCTYPE html>\n<html>\n<head>\n <script>\n var theScope = scope;\n \n function updateEntry(){\n let t_start = document.getElementById(\"editStart\").value;\n theScope.send({\n payload:{t_start:t_start}\n });\n }\n\n </script>\n</head>\n\n <body>\n <div class=\"container\">\n <label for=\"editStart\">Start Time:</label>\n <input type=\"time\" class=\"form-control\" id=\"editStart\" name=\"editStart\" value=\"{{msg.payload.start_time}}\">\n <button type=\"button\" class=\"btn btn-primary btn-md\" onMouseDown=\"updateEntry()\">Send time to flow</button>\n </div>\n </body>\n</html>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 670,
        "y": 740,
        "wires": [
            [
                "70ff830ce29d4d03"
            ]
        ]
    },
    {
        "id": "70ff830ce29d4d03",
        "type": "debug",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 850,
        "y": 740,
        "wires": []
    },
    {
        "id": "4746976437be4507",
        "type": "function",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "func": "msg.payload = {\n start_time: \"15:24\",\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 740,
        "wires": [
            [
                "b65d27e437f51a17"
            ]
        ]
    },
    {
        "id": "3fb8e950ac7e27c1",
        "type": "inject",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 340,
        "y": 740,
        "wires": [
            [
                "4746976437be4507"
            ]
        ]
    },
    {
        "id": "903a6ab8.4f4ca8",
        "type": "ui_group",
        "name": "Home",
        "tab": "e2e6f4f5.56f91",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "e2e6f4f5.56f91",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "order": 2,
        "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:** [16 August 2022 16:35 UTC](https://discourse.nodered.org/t/not-able-to-prefill-form-node-time-field/65792/5 "2022-08-16T16:35:10Z")

</div>

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