TypedInput Select Box - allways String value

Hello,

I'm trying to get values from the typedInput selectBox as integers in my custom node. These values should be linked to binary operations via the config in the js file. But I am not able to get this value in the flow-file as an integer.

I fill the selectboxes in onprepare:

const colourSelOff = {type:'num',types:[{options: [ { value: 0, label: "Off"}, { value: 1, label: "Red"},{ value: 2, label: "Green"}, { value: 3, label: "Blue"}, { value: 4, label: "Orange"}]
$("#node-input-ledOnColor0").typedInput(colourSelOff);

the defaults are defined as follows:

defaults: {
            ledOnColor0: {value:0, validate:RED.validators.number(), required: true},
            ledOffColor0: {value:0, validate:RED.validators.number(), required: true},
            ledOnColor1: {value:0, validate:RED.validators.number(), required: true},
            .........

But in the flow file it looks like this:
not changed (default) values integer and those from the typedInput string

        "ledOnColor0": "1",
        "ledOffColor0": "2",
        "ledOnColor1": 0,
        "ledOffColor1": 0,

In the documentation I only ever find examples with string values.
Do you always have to work with strings in html and convert these values in the js file using parseInt, or is there a direct option with this widget ?

Thanks in advance

Parsing in the runtime is probably the easiest solution.

Alternatively, you could do the conversion in the oneditsave function instead.

Thank you very much for the quick reply!

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