Skip to Content
Former Member
Jun 20, 2017 at 04:15 PM

Dropdown scripts using onSelect event return incorrect key

216 Views Last edit Jun 20, 2017 at 04:28 PM 2 rev

I'm trying to make it so that the key selected in the top dropdown automatically populates the input box below:

The code is really simple, triggered by the only event available for dropdowns ("onSelect"):

session.findById("wnd[0]/usr/ctxtYPCN-PCTYPE").text =  session.findById("wnd[0]/usr/subPersonas_149796688890599/cmbPersonas_14979739727949").key;

However, the onSelect event seems to fire before the dropdown's value updates. For example, when I make my first selection, nothing happens (because it's pulling the placeholder value):

... and then when I make more selections, the script pulls the previous key:

Is there a way to get onSelect to behave as you'd expect? If not, what is the onSelect event supposed to actually be used for? Should this script be attached to onAfterRefresh instead?


dropdown1.jpg (7.1 kB)
dropdown2.jpg (9.1 kB)
dropdown3.jpg (9.1 kB)