Dropdown list linked to Database


I want to create a dropdown list, which is linked to a database integer tag.
Database tag:
Name: Mode
datatype: Integer
value: 0: Off, 1: Manual, 2: Auto

I want to have dropdown list on the screen, it should display the description of the selected mode (Off/Manual/Auto) and the operator can select the new mode. Once the selection is done, it can update the mode integer value in the database.

The display of the current selected mode is not an issue. I have created a database tag associated with the mode. But I have issue to modify the mode from dropdown list on the screen.

I understand that to update the database linked tag I need to write script “system.db.runUpdateQuery”. But while entering script from the event script window, I cannot find the right event handlers to choose.
I was expecting some event like “Dropdown list selection complete” but it’s not a option in the “event handlers” list.

I tried the script from the following post, but I cannot get it working correctly.

Appreciate if anyone can help on it?

I think the event handler you’re looking for is ComponentEvents/onActionPerformed. What is the error you’re getting?