Updated node properties are not persisted

#1

I have created a node which has 3 properties. My HTML looks like following

  <script type="text/javascript">
    RED.nodes.registerType('person-data',{
        category: 'function',
        color: '#a6bbcf',
        defaults: {
        age: {value:"45"}  
        },
        inputs:1,
        outputs:1,
        icon: "file.png",
        label: function() {
            return this.name||"person-data";
        }
    });
</script>

    <script type="text/x-red" data-template-name="person-data">
        <div class="form-row">
            <label for="node-input-name"><i class="icon-tag"></i> name</label>
            <input type="text" id="node-input-name" placeholder="name"><br/>
        </div>
        <div class="form-row">
            <label for="node-input-age"><i class="icon-tag"></i>age</label>
            <input type="text" id="node-input-age" placeholder="age"><br/>
        </div>
    </script>

I can drag and drop the node from the palet. When I double click on it, I can see my 2 properties name and age. Then I give values and click ‘Done’ button. When I double click on the node again, I cannot see the given values for properties.

I tried removing and re-installing my node and also removing .config.json file but anything didn’t work. This problem is not there for the node which are already there. ex: twitter.

What is the reason for this issue?

0 Likes

#2

adding default values for all properties solved the issue. Is this a bug?

0 Likes

#3

No. The defaults object tells the editor what properties it should get/set. If it isn’t listed in the defaults object it will be ignored. That’s how it works.

0 Likes