Is there a more elegant way to use an input field that only needs part of the selection to be returned?

In the JavaScript snippet below, you need to modify the key-value pairs in the code and the Popup Menu, but the result is elegant:




In iOS, you would add this code to a JavaScript snippet:

// Define the bank accounts directly
let accountNumber = {
  "Checking Account": "12345",
  "Savings Account": "67890",
  "Investment Account": "11223"
};

let account = "%fillpopup:name=Select the account:default=Checking Account:Savings Account:Investment Account%";

accountNumber[account];

%filltop%