Data selected in Dropdown fields is resetting upon opening the form due to format script..
I have recently added the following format script to automatically populate the dropdown fields when text is entered in certain fields:
var emailList = [" "];
if(event.value){emailList.push(event.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").setItems(emailList);
However, I believe that this code is executing upon opening the form, meaning that any values in the dropdown list that were previously saved are removed due to this code running again and resetting the dropdown list to the initial value which is " ".
I am wondering how I can prevent this happening so the format script doesn't run upon the form opening and only runs when there is a change in that event field? As at the moment it is giving the impression that there was no data entered in the dropdown field, which isn't the case.
