Custom Node question: Changing a parameter value when another parameter value changes in custom hooks

Hi,

I’m trying to build a custom node.

In the node, I have two input fields: A drop down list and a text field. I’d like to change the value of the text field when somebody selects a value in the dropdown (regardless if the user made any changes to the contents of the text field).

I’m able to listen to changed parameter values in a n8nExternalHooks javascript file, but I can’t seem to see how to change the value?

window.n8nExternalHooks = {
nodeSettings: {
valueChanged: [
function (store, meta) {
if (meta.parameterPath === ‘myDropDown’) {
// How do I change the value of parameter ‘myTextField’?
}
}
]
},

Maybe i’m approaching this the wrong way but some guidance would be greatly appreciated.

With kind regards,
Erwin

Hi @erwinvandervalk, welcome to the community :tada:

I have no idea if this is possible from an external hook but shall ask internally if anyone knows more.

Internal hooks are not for this. You can use the displayOptions property in the node’s description to achieve this. Depending on what the user selected in the dropdown, you show an input with the value you want. I encourage you to find the behavior you want in one of the nodes we have and check the node specifically in the repo.

1 Like

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