Multiple input event functions

Hello everyone. I’m trying to write a URCap that takes in inputs from multiple HTML input-boxes and updates a preview every time any of those inputs are updated. I’m working from the example in the HelloWorld-URCap supplied with the SDK using:
@Input(id = “YourInputIDHere”)
onInput(InputEvent event) { func }

But I can’t define more than one of those functions, and don’t know how to supply more than one input ID to the one I have. Any ideas? I assume some kind of OR-operator, but all my attempts so far have given errors already in the compiler.

Nevermind, I’ve gone blind. I’m sorry. This is a duplicate of this post, that already features a great answer by Jacob:

One option you have is to simply rename the functions, for example:

@Input(id = “input1”)
onChange1(InputEvent event) { func }

@Input(id = “input2”)
onChange2(InputEvent evetn) { func }

and so on…

I was at this point just a few days ago until i realised that the name of the function seems to be unimportant for the functionality of it

Yeah, thank you so much, but I found your post as a suggested topic right after I had created my own with exactly the same question. We even had the same exact misunderstanding in that I also thought onInput was a reserved, unchangeable name. It’s good to know I am not alone.

1 Like