# Multiple input event functions

**URL:** <https://forum.universal-robots.com/t/multiple-input-event-functions/1600>\
**Category:** Java\
**Created:** [February 7, 2018, 12:29pm UTC](https://forum.universal-robots.com/t/multiple-input-event-functions/1600 "2018-02-07T12:29:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon24768507](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon24768507](https://forum.universal-robots.com/u/anon24768507)\
**Post date:** [February 7, 2018, 12:29pm UTC](https://forum.universal-robots.com/t/multiple-input-event-functions/1600/1 "2018-02-07T12:29:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon24768507](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon24768507](https://forum.universal-robots.com/u/anon24768507)\
**Post date:** [February 7, 2018, 12:32pm UTC](https://forum.universal-robots.com/t/multiple-input-event-functions/1600/2 "2018-02-07T12:32:04Z")

</div>

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

> [@EventFunction for multiple InputFields](http://forum.universal-robots.com/t/eventfunction-for-multiple-inputfields/1573):
>
> Hello everyone, I’m relatively new to the URCaps universe and currently writing on a URCap for my first project. Now the problem is that i need an Installation node with multiple InputFields and all of them should be stored in the DataModel. But how? Usign the code from the sample Programs brings me to the point where i got multiple declarations for the same functions with a scheme like that: @Input(id = \<INPUT\_NAME\>) public void onMessageChange(InputEvent event) { if ( event.getEventType…

---

<div class="post-metadata">

**Author:** ![anon29260635](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@anon29260635](https://forum.universal-robots.com/u/anon29260635)\
**Post date:** [February 7, 2018, 12:51pm UTC](https://forum.universal-robots.com/t/multiple-input-event-functions/1600/3 "2018-02-07T12:51:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon24768507](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon24768507](https://forum.universal-robots.com/u/anon24768507)\
**Post date:** [February 7, 2018, 1:22pm UTC](https://forum.universal-robots.com/t/multiple-input-event-functions/1600/4 "2018-02-07T13:22:45Z")

</div>

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.
