# How to set the ui button that will on click it should send value 1 and after release it should send 0

**URL:** https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382
**Category:** General
**Created:** [6 September 2022 08:51 UTC](https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382 "2022-09-06T08:51:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ganesh](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Ganesh](https://discourse.nodered.org/u/Ganesh)
#### Post date: [6 September 2022 08:51 UTC](https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382/1 "2022-09-06T08:51:51Z")

</div>

I want to create a ui button for dashboard that will perform the following function

On Click it should send value one and after release it should send value 0 like a push button

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [6 September 2022 08:55 UTC](https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382/2 "2022-09-06T08:55:19Z")

</div>

I don't believe you can. Only the click event is defined.

You will need to use a ui\_template node to create your own button and add the appropriate event handlers.

---

<div class="post-metadata">

### Author: ![Ganesh](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Ganesh](https://discourse.nodered.org/u/Ganesh)
#### Post date: [6 September 2022 11:43 UTC](https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382/3 "2022-09-06T11:43:33Z")

</div>

I was able to create it in ui template node is there a way to add some delay between the events

```auto
[
    {
        "id": "0700c9ae90deec91",
        "type": "ui_template",
        "z": "7cfb14150528f229",
        "group": "722e3efd98038504",
        "name": "PSU 1",
        "order": 15,
        "width": 3,
        "height": 1,
        "format": "<button class=\"resetButton\" ng-mousedown=\"send({payload: 1})\" ng-mouseup=\"send({payload: 0})\" style=\"border-radius:20px;padding-top:7px;padding-bottom:7px; border: 1px solid #ffc65f;background-color: white;font-family:quicksand; margin-top:1px; \">Reset</button>\n<style>\n .resetButton:hover{\n background-color: #f9f9f9 !important;\n }\n</style>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 870,
        "y": 280,
        "wires": [
            [
                "bf6296581a8d70e6"
            ]
        ]
    },
    {
        "id": "722e3efd98038504",
        "type": "ui_group",
        "name": "Power Supply",
        "tab": "0770fd16725d9e83",
        "order": 9,
        "disp": true,
        "width": "23",
        "collapse": false,
        "className": ""
    },
    {
        "id": "0770fd16725d9e83",
        "type": "ui_tab",
        "name": "power supply",
        "icon": "dashboard",
        "order": 10,
        "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: [5 November 2022 11:43 UTC](https://discourse.nodered.org/t/how-to-set-the-ui-button-that-will-on-click-it-should-send-value-1-and-after-release-it-should-send-0/67382/4 "2022-11-05T11:43:43Z")

</div>

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