Copy link to clipboard
Copied
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.
Honestly this is all you need:
var f = event.target;
var emailList = [event.value,""];
if(this.getField("a").value) {emailList.push([this.getField("a").value]);}
if(this.getField("b").value) {emailList.push([this.getField("b").value]);}
if(this.getField("c").value) {emailList.push([this.getField("c").value]);}
f.setItems(emailList);
You can run it as custom calculation script and also as custom format script.
It updates on real-time and if the user deletes the other two email and decides
...Copy link to clipboard
Copied
Honestly this is all you need:
var f = event.target;
var emailList = [event.value,""];
if(this.getField("a").value) {emailList.push([this.getField("a").value]);}
if(this.getField("b").value) {emailList.push([this.getField("b").value]);}
if(this.getField("c").value) {emailList.push([this.getField("c").value]);}
f.setItems(emailList);
You can run it as custom calculation script and also as custom format script.
It updates on real-time and if the user deletes the other two email and decides to delete the third entry, clicking on the empty item of the drop down menu clears the box.
Copy link to clipboard
Copied
Thanks for the help guys. Got it working as hoped now, appreciate the time you spent helping me.