# Problems with Custom Event

**URL:** <https://discourse.nodered.org/t/problems-with-custom-event/85973>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [27 February 2024 22:01 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973 "2024-02-27T22:01:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [27 February 2024 22:01 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973/1 "2024-02-27T22:01:28Z")

</div>

I was trying to generate a custom even as described in the Dashboard 2 Info;

```auto
<v-btn @click="$socket.emit('ui-event', 'custom-event-name', msg)">Send Custom Event</v-btn>

```

I created a ui-template with the following code

```auto
<template>
    <div class = "gapButton">
        <v-btn @click="$socket.emit('ui-event', '$myEvent', {topic: 'event'})">Event</v-btn>

        <v-btn @click="sendData()">Event Data</v-btn>

        <v-btn @click="sendEvent()">Send Event</v-btn>

    </div>

</template>

<script>
    export default {
        data() {
            // define variables available component-wide
            // (in <template> and component functions)
            return {
                eventData: {topic: '$myEvent', payload: {id: this.id}}
            }
        },

        methods: {
            sendData: function () {
                this.send( this.eventData )

            },

            sendEvent: function() {
                this.$socket.emit( 'ui-event', '$myEvent', {topic: 'event'} )
            }

        },

    }
</script>

<style>
    .gapButton {
        display: flex;
        gap: 0.2rem;
    }
</style>

```

and then connected up an event node and a debug node. My thought was that I should get an output when my event was emitted, but not so. I have either messed up the generator, or I have got the wrong end of the stick and this is not how it is supposed to work.

Hopefully someone can put me straight

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [28 February 2024 16:09 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973/2 "2024-02-28T16:09:20Z")

</div>

I need ton investigate this, busy prepping for Webinar tomorrow, but have set myself a reminder to get back to you on Friday morning

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [1 March 2024 09:29 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973/3 "2024-03-01T09:29:59Z")

</div>

Can confirm this doesn't work, when it should/ Will open an issue and investigate.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [1 March 2024 11:08 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973/4 "2024-03-01T11:08:57Z")

</div>

PR opened with a fix/update to the documentation: [UI Event: Ensure consistency in API & docs for custom UI Events by joepavitt · Pull Request #632 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/pull/632)

---

<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:** [31 March 2024 11:09 UTC](https://discourse.nodered.org/t/problems-with-custom-event/85973/5 "2024-03-31T11:09:26Z")

</div>

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