# Predefined node field input types

**URL:** https://discourse.nodered.org/t/predefined-node-field-input-types/55959
**Category:** Developing Nodes
**Created:** [1 January 2022 16:09 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959 "2022-01-01T16:09:32Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [1 January 2022 16:09 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/1 "2022-01-01T16:09:32Z")

</div>

Is there a list of the available input types somewhere so these can be included in an input definition?

This is from the inject node so I suspect it includes all the predefined ones.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7dee1e6ed6e7b33b8c58db9bae5d2d53823d46c7.png)

---

<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: [1 January 2022 16:18 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/2 "2022-01-01T16:18:22Z")

</div>

[https://nodered.org/docs/api/ui/typedInput/#types](https://nodered.org/docs/api/ui/typedInput/#types)

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [1 January 2022 16:21 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/3 "2022-01-01T16:21:58Z")

</div>

Great thanks. Exactly what I am after.

It would be really good if these API docs were linked to from the [Creating Nodes : Node-RED](https://nodered.org/docs/creating-nodes/) docs.

---

<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: [1 January 2022 16:22 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/4 "2022-01-01T16:22:43Z")

</div>

No doubt. I'm sure a PR that added such a link in the right place would be warmly received.

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [3 January 2022 13:17 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/5 "2022-01-03T13:17:31Z")

</div>

As it is related, I will ask it here. In the node I am working on, there is a function that obviously acts on the field input type selected.

I need to add several new options, but cannot see what the right code might be to do so.

I have guessed for `num`, but not sure for `jsonata` or `env` (I have added the `case` stubs).

Might the env entry simply be `node.context().env.get(config[key]);`?

Have I missed something in the docs that explains this? Possibly I have misunderstood the purpose of this function completely ☹ .

```auto
function typedDataFactory(RED, config, node) {
    return function getTypedInput(msg, key) {
        const type = key + 'Type';

        if (!config[type]) return config[key];

        switch (config[type]) {
            case 'str':
                return config[key];
            case 'date':
                return new Date();
            case 'msg':
                return RED.util.getObjectProperty(msg, config[key]);
            case 'flow':
                return node.context().flow.get(config[key]);
            case 'global':
                return node.context().global.get(config[key]);
            case 'num':
                return config[key];
            case 'jsonata':

            case 'env':

            default:
                break;
        }
    }
}

```

---

<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: [3 January 2022 13:45 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/6 "2022-01-03T13:45:19Z")

</div>

For all of the built-in types you can use `RED.util.evaluateNodeProperty`

> <https://github.com/node-red/node-red/blob/master/packages/node_modules/@node-red/util/lib/util.js#L608>

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [3 January 2022 14:01 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/7 "2022-01-03T14:01:29Z")

</div>

Thanks.

This node originates a long time ago so perhaps that wasn't a thing when it was first written.

Is there anything in the docs on how to use this? (Just realised the docs are not searchable).

---

<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: [3 January 2022 14:08 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/8 "2022-01-03T14:08:16Z")

</div>

No, this isn't currently explicitly documented other than by example in the core nodes.

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [3 January 2022 14:12 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/9 "2022-01-03T14:12:30Z")

</div>

Ok, thanks.

---

<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: [17 January 2022 14:12 UTC](https://discourse.nodered.org/t/predefined-node-field-input-types/55959/10 "2022-01-17T14:12:42Z")

</div>

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