# typedInput API type/types query

**URL:** https://discourse.nodered.org/t/typedinput-api-type-types-query/55962
**Category:** Developing Nodes
**Created:** [1 January 2022 17:56 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962 "2022-01-01T17:56:26Z")
**Posts on this page:** 8
**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 17:56 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/1 "2022-01-01T17:56:26Z")

</div>

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

In the docs it lists 3 Options;  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/73f619ae41045029453546f187ebb548107fdcb0.png)

But in the examples is has `type` which is not listed as an option.

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

Is `type` the default for this input? Could I replace `type:'str'` with `type:'num'` such that the default selection is `num`?

Does `type` and `default` mean the same thing?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [1 January 2022 18:32 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/2 "2022-01-01T18:32:19Z")

</div>

I think so yes.

---

<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 19:01 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/3 "2022-01-01T19:01:43Z")

</div>

That is a mistake in the docs. You should use `default` not `type` to set the initial type of the input.

---

<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 19:54 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/4 "2022-01-01T19:54:37Z")

</div>

@knolleary I saw in another thread you said you'd updated the docs and wanted some feedback.

I note the use of single and double quotes appears to not be consistent. If some instances need to be single /double, it would be useful to state that (or it might be a standard Javascript thing).

e.g.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96d589a036d55eca8cba05b8017a9fea19fc0480.png)

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

I'm also not clear in the first clip above if `$(.input).` would ever be used as I understood it would always be of the form `#node-input-`.

If there is to be only one `type`, does the `types` array need to be defined (Clip 2 above).

My other thought is that I still do not understand why I would use the `typeField`. I have experimented but cannot see what impact it has. Some additional explanation and perhaps an example would be useful.

Just the view from coming to this for the first time - I understand how hard documentation is :).

---

<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: [1 January 2022 20:09 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/5 "2022-01-01T20:09:15Z")

</div>

Single and double-quotes are equal in JavaScript.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [1 January 2022 20:13 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/6 "2022-01-01T20:13:12Z")

</div>

Hi @borpin

> [@borpin](#):
>
> My other thought is that I still do not understand why I would use the `typeField`

Im sure you read the explanation in the docs but just in case...

> In some circumstances it is desirable to already have an \<input\> element to store the type value of the typedInput. This option allows such an existing element to be provided. As the type of the typedInput is changed, the value of the provided input will also change.

To paraphrase - if you add a hidden input element & provide it's selector to the `typeField` property, the typedInput will store your selection for you, meaning (for example) you don't need to save it's value manually in `oneditsave`

---

<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 23:07 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/7 "2022-01-01T23:07:47Z")

</div>

> [@Steve-Mcl](#):
>
> if you add a hidden input element & provide its selector to the `typeField` property, the typedInput will store your selection for you, meaning (for example) you don't need to save its value manually in `oneditsave`

Ah, yes, that makes sense - or rather it explains it in a way I understand (always the problem with documentation), 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: [2 March 2022 23:08 UTC](https://discourse.nodered.org/t/typedinput-api-type-types-query/55962/8 "2022-03-02T23:08:01Z")

</div>

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