Data entered in typedInput() is stored as string in editableList. Unable to get datatype

Hi,

I've created my own node, and it's working fine. I do however find it difficult to read data input from my editableList to the correct format. My challenge is:
When reading data that is typed into my editablelist, I get the result in string. I found that the method $("name").editableList('items')[index].find("node-input-elementname").val() provides me with the correct data, but it's as a string.

Is there a different method I can use to get the value in correct format? Is there a method that can provide me with the correct datatype that is used with .typedInput()? If so, I could cast the value before storing the value.
I use some data input fields with string, some with number, and some where's it's possible to choose:
image

I tried finding the datatype in the jQuery element, but couldn't find anything sensible.

In oneditsave I do the following when pushing data to the node:

var items = $("#node-input-container").editableList('items');
            var node = this;
            node.props = [];
            items.each(function (i) {
                var property = $(this);
                var r = {
                    name: property.find(".node-input-name").val(),
                    high: property.find(".node-input-engHigh").val(),
                    low: property.find(".node-input-engLow").val()
                }
            }
            node.props.push(r);

When I do send node.props with send({"payload":node.props); in the javascript file, I get high and low in string. I also find these values in string when inspecting the html.

I therefore tried casting the values that are pushed to the node, which worked fine:

                var r = {
                    name: property.find(".node-input-name").val(),
                    high: Number(property.find(".node-input-engHigh").val()),
                    low: Number(property.find(".node-input-engLow").val())
                }
            }
            node.props.push(r);

Here's how I generated the html-areas and used .typedInput():


I initially tried different parameters in typedinput, because I didn't get the result I wanted.

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