How to auto add values from text fields to Combo Box/Dropdown list?
On my PDF I have three Email Address text fields - when a value is entered into one of these fields I would like the entered value to automatically be added to a combo box to allow the user to select which email address they would like to use to receive correspondence.
So far I have the following code added to the combo box:
var emailList = [" "];
if(this.getField("EmailAddress1").value) {
emailList.push([this.getField("EmailAddress1").value]);
}
if(this.getField("EmailAddress2").value) {
emailList.push([this.getField("EmailAddress2").value]);
}
if(this.getField("EmailAddress3").value) {
emailList.push([this.getField("EmailAddress3").value]);
}
this.getField("PortfolioCorrespondenceEmail1").clearItems();
this.getField("PortfolioCorrespondenceEmail1").setItems(emailList);
This code does return the values as hoped, however, I am required to click in the dropdown to refresh the values in the list, this may give the impression to users that there are no emails available for selection as initially there is just a " " option until the values are loaded into the list.
I have selected "commit selected value immediately" but it doesn't seem to fix the problem. At the moment I have no code in the custom keystroke, I am wondering whether there is something I should add in there?
Update: I have since moved the code into the custom calculation area and the dropdown list options are populating immediately, however it won't let me select one of the options. When I select one of the options it just looks like the list is reloading and the option doesn't select.
