Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 15, 2020 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/afc2627f9621b992f12b4cd69243ff5a to your computer and use it in GitHub Desktop.
Save bjoerntx/afc2627f9621b992f12b4cd69243ff5a to your computer and use it in GitHub Desktop.
function addDropDownFormField(items) {
TXTextControl.formFields.getCanAdd(canAdd => {
if (canAdd) {
TXTextControl.formFields.addSelectionFormField(0, sff => {
// no custom text
sff.setEditable(false);
sff.setItems(items);
// select "Uber"
sff.setSelectedIndex(3);
});
}
});
}
var transportation = ["Bicycle", "Car", "Scooter", "Uber", "Cab"];
addDropDownFormField(transportation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment