Node configuration: setting input fields

Hi all,

For a node I developed, I'm trying to implement an export/import function of the node configuration to/from an xml file. This because the xml file is used to make the same configuration in the program it's talking to.

The export functionality is done, the import functionality has the file dialog selection and xml parsing. The only struggle is setting the input fields in a correct way.

Problem one:
I set the value of an input field like this. But it's only visible after reopening the node-editor.

$("#node-input-listId").val( newValue );

Problem two:
The node uses a multi-line editor (preferable the Monaco editor as it has the syntax highlight for the needed language). But I haven't found a way to set the text inside the editor. Does the node-red wrapper provide a function for that like editor.setValue()? If not what will be the most correct way to do this?

Thanks in advance

That should work. You will need to share more info (perhaps a link to the repository) so we can see what you are doing.

Yes, editor.setValue() is available. How are you creating the editor?

I was maybe a bit to fast with launching this question. On a second try the editor.setValue() seems to work. I must have done something wrong on the first try.

For the input I figured out that it's different for a typedInput as the original input field is hidden. From the documentation it should be:

$("#node-input-listId").typedInput('value', newValue);

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