Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active March 9, 2020 14:48
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/9d45884910734ea906daf709433908c6 to your computer and use it in GitHub Desktop.
Save bjoerntx/9d45884910734ea906daf709433908c6 to your computer and use it in GitHub Desktop.
function addComboFormField() {
TXTextControl.formFields.getCanAdd(canAdd => {
if (canAdd) {
// Add form field
TXTextControl.formFields.addSelectionFormField(emptyWidth, ff => {
var cars = ["Porsche", "BMW", "Dodge", "Mercedes", "Ford"];
ff.setItems(cars);
ff.setSelectedIndex(4);
highlight(ff);
});
} else {
console.log("Cannot add field at that location.");
}
});
}
function highlight(formField) {
var highlightColor = "rgba(9, 165, 2, 0.3)";
var highlightMode = TXTextControl.HighlightMode.Always;
formField.setHighlightColor(highlightColor);
formField.setHighlightMode(highlightMode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment