# Upgrading Nodes specifically my own

**URL:** <https://discourse.nodered.org/t/upgrading-nodes-specifically-my-own/2641>\
**Category:** Developing Nodes\
**Created:** [28 August 2018 17:42 UTC](https://discourse.nodered.org/t/upgrading-nodes-specifically-my-own/2641 "2018-08-28T17:42:39Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![scargill](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scargill/32/1118_2.png) [@scargill](https://discourse.nodered.org/u/scargill)\
**Post date:** [30 August 2018 13:42 UTC](https://discourse.nodered.org/t/upgrading-nodes-specifically-my-own/2641/21 "2018-08-30T13:42:19Z")

</div>

Thanks all. The validation is back in. The ONLY thing that made a difference was the line:

```auto

```

```auto
validate:function(v) { return ((v === "") || (RED.validators.number(v)) }

```

Change to the js file (|| 0) and that oneditprepare made no difference (I’ve put them in as a reminder but commented out) . As I’m not comparing for 0 but only comparing for days 1-7 and months 1-12 I don’t seem to need the rest. While I was on, just to test as would happen to someone else, I added another day.

All appears fine thanks.

Pete

---

<div class="post-metadata">

**Author:** ![H3llsing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/h3llsing/32/40624_2.png) [@H3llsing](https://discourse.nodered.org/u/H3llsing)\
**Post date:** [25 June 2021 16:11 UTC](https://discourse.nodered.org/t/upgrading-nodes-specifically-my-own/2641/22 "2021-06-25T16:11:39Z")

</div>

hey,  
i came across the same problem now.  
do you have also a solution for typedInputs? Because there the validator is depending on it's selected type.

Bonus Question 😃 -\> is it possible to load a json file as default inside? I got a schema field and it should come with a default, but it's really big.

**EDIT:**  
i found a solution 🙂  
since nodered 1.3 its possible to serve extra resources in a node  
[https://nodered.org/docs/creating-nodes/resources](https://nodered.org/docs/creating-nodes/resources)

and in the on edit prepare you could do something like this:

```auto
 var exampleVal = $("#node-input-example").typedInput('value');
            console.log(exampleVal)

            if (!exampleVal || exampleVal === '{}') {
                $.ajax({
                    url: 'resources/my-node-module-name/example.json',
                    dataType: 'json',
                    success: function (response) {
                        $("#node-input-example").typedInput('value', JSON.stringify(response));
                    }
                });
                
            }

```

in the js file its easier to load the json file, but also necessary because the graph of the node can be triggered before you execute the onEditPrepare

```auto
const EXAMPLE_CONFIG = require('./example.json');
 if (!config.example || config.example === '{}') {
            node.debug("using my default example")
            node.example = JSON.stringify(EXAMPLE_CONFIG);            
        } else {
            node.debug("using example defined by user")
            node.example = config.example;
        }

```

[Previous page](https://discourse.nodered.org/t/upgrading-nodes-specifically-my-own/2641.md?page=1)
