Universal Robots Forum

OnChange listener for <select> elements

It appears that on change functions for select HTML elements do not work. Example:

	@Select(id = SELECT_ELEMENT_ID)
	public void onSelectChange(InputEvent event) {
		if (event.getEventType() == InputEvent.EventType.ON_CHANGE) {
			//code to handle
		}
	}

The above will never execute. Is there a way to capture this or am I missing something?

Thanks

You need to use the SelectEvent instead of the InputEvent object for select elements.

1 Like

Here is some more context on using drop down menus. Following the whip welding sample Sample: Whip welding URCap

The select event should look like this following that sample. image

It’s important to note that you should keep track on weather or not the user has selected a feature or not and save this to the model so when openView() is called you can go back to the selected feature.

1 Like