# Not able to pre fill value in text input stored in defaults

**URL:** <https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899>\
**Category:** Developing Nodes\
**Created:** [19 January 2023 07:33 UTC](https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899 "2023-01-19T07:33:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![syedhannan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/syedhannan/32/72932_2.png) [@syedhannan](https://discourse.nodered.org/u/syedhannan)\
**Post date:** [19 January 2023 07:33 UTC](https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899/1 "2023-01-19T07:33:45Z")

</div>

I have stored a value in defaults which I want to pre fill in the editor but it doesn't show up.

```auto
    defaults: {
      name: { value: "" },

      hs_Timezone: { value: "" },
      hs_IP: { value: "12345" }, //not shown in editor
      ...

```

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

This is the html code:

```auto
      <div class="form-row">
        <label for="node-input-hs_IP"><span> IP</span></label>
        <input
          type="text"
          id="node-input-hs_IP"
          style="width: 250px;"
          placeholder="IP"
        />
      </div>

```

---

<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:** [19 January 2023 09:28 UTC](https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899/2 "2023-01-19T09:28:33Z")

</div>

You will need to use oneditprepare to test if the value is empty and add it to the UI with jQuery.

---

<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 January 2023 10:50 UTC](https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899/3 "2023-01-19T10:50:16Z")

</div>

It should apply for any **newly added** instance of the node, but it will not apply for existing instances of the node.

The `defaults` only get applied when the node is added to the workspace. Otherwise you have to, as Julian says, add some logic to `oneditprepare` to ensure it gets applied.

---

<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 February 2023 10:51 UTC](https://discourse.nodered.org/t/not-able-to-pre-fill-value-in-text-input-stored-in-defaults/73899/4 "2023-02-02T10:51:02Z")

</div>

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