# Configuration Node displays Node ID and not the result of the label function

**URL:** https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049
**Category:** General
**Created:** [19 November 2018 18:38 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049 "2018-11-19T18:38:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rmckinnon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmckinnon/32/3536_2.png) [@rmckinnon](https://discourse.nodered.org/u/rmckinnon)
#### Post date: [19 November 2018 18:38 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049/1 "2018-11-19T18:38:38Z")

</div>

The issue is probably something obvious but my code looks close to the example from [https://nodered.org/docs/creating-nodes/config-nodes](https://nodered.org/docs/creating-nodes/config-nodes).

**Behavior:**  
After deploying the flow, the config node within in the select element displays the node id rather than the function result from the label.

**Screenshot**

 ![Node-RED_config_node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2958179ce3b7c4e1f20409f98c7bc891be8da851.png)

**Code:**

```
<script type="text/javascript">
RED.nodes.registerType('server',{
    category: 'config',
    credentials: {
        username: {type: "text", required:true},
        password: {type: "password"}
    },
    defaults: {
        host: {value:"localhost",required:true},
    },
    label: function() {
        return this.host + ' (' + this.credentials.username + ')';
    }
});

```

```
<script type="text/x-red" data-template-name="server">
<div class="form-row">
    <label for="node-config-input-host"><i class="fa fa-server"></i> Host</label>
    <input type="text" id="node-config-input-host" placeholder="Host">
</div>
<div class="form-row">
    <label for="node-config-input-username"><i class="fa fa-user-circle"></i> Username</label>
    <input type="text" id="node-config-input-username" placeholder="Username">
</div>
<div class="form-row">
    <label for="node-config-input-password"><i class="fa fa-user-secret"></i> Password</label>
    <input type="password" id="node-config-input-password" placeholder="Password">
</div>

```

---

<div class="post-metadata">

### Author: ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)
#### Post date: [19 November 2018 19:08 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049/2 "2018-11-19T19:08:14Z")

</div>

You have not included a picture of the Config node's edit panel, but I'm guessing you don't have a "name" field defined? I think the default behavior in the non-config node is to show the config node's name, and if not found use the id instead... Why the "label" function is not being used instead of the name might be a bug (or it might be that the label function is only used within the flow editor, not the edit panel)?

---

<div class="post-metadata">

### Author: ![rmckinnon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmckinnon/32/3536_2.png) [@rmckinnon](https://discourse.nodered.org/u/rmckinnon)
#### Post date: [19 November 2018 21:51 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049/3 "2018-11-19T21:51:10Z")

</div>

> [@shrickus](#):
>
> You have not included a picture of the Config node's edit panel, but I'm guessing you don't have a "name" field defined?

That is correct, I don't have a name field: just host, username and password.

> [@shrickus](#):
>
> Why the "label" function is not being used instead of the name might be a bug (or it might be that the label function is only used within the flow editor, not the edit panel)?

I am hoping someone on the forum can help determine if it is a bug or help identify the error in my code. It's probably something with my code since I see other 3rd party nodes working fine.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [19 November 2018 22:07 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049/4 "2018-11-19T22:07:46Z")

</div>

You cannot use `this.credentials.anything` in the label as credentials are not generally available to the editor. You are probably getting an error in the browser's JavaScript console about trying to reference username of undefined.

---

<div class="post-metadata">

### Author: ![rmckinnon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmckinnon/32/3536_2.png) [@rmckinnon](https://discourse.nodered.org/u/rmckinnon)
#### Post date: [20 November 2018 02:52 UTC](https://discourse.nodered.org/t/configuration-node-displays-node-id-and-not-the-result-of-the-label-function/5049/5 "2018-11-20T02:52:42Z")

</div>

> [@knolleary](#):
>
> You cannot use `this.credentials.anything` in the label as credentials are not generally available to the editor. You are probably getting an error in the browser's JavaScript console about trying to reference username of undefined.

This looks to be the case. I checked the JavaScript console and there were errors and I removed the "this.credentias.username" and all is working.
