Copy link to clipboard
Copied
Hi Great Developers...
Actually I Started building form (Acrobat Pro DC) and adding Drop down list and i need to dynamically let the user to add list of emails manually so i insert (Add Button) and (Delete Button) to Add items or delete items to list, for the Adding items Button i wrote the following (my drop down list name is "EmailList" :
Add Button JavaScript (not working) :
var oFld = this.getField("EmailList");
var cEntry = oFld.getItemAt(oFld.currentValueIndices,false);
oFld.insertItemAt(cEntry , "s", 0);
and for Delete items Button JavaScript (working code) :
var f = this.getField("EmailList");
f.deleteItemAt(f.currentValueIndices);
now the problem is the Add Button JavaScript is not Working! , please help me if it can be done, thanks in advance
Mohammad Hasanin
1 Correct answer
Thank you for your reply, i succeed in modifying the code so it becomes :
for Adding to dropdown menu from text field it will be :
//Add current email to DropDown list
var emailvalue = this.getField("emailbyuser").value;
var f = this.getField("EmailList");
f.insertItemAt(emailvalue , "", 0);
and for deleting the selected value from dropdown menu it will be :
//Delete current selected value from emaillist
var f = this.getField("EmailList");
f.deleteItemAt(f.currentValueIndices);
Copy link to clipboard
Copied
You're add script isn't adding anything new to the list. It looks like it is trying to move an existing item to the top of the list.
Here's an article that includes a sample file with a button for adding an item to a list, from another list. In your case you might want this to be from a form field, but the script will be almost exactly the same.
https://acrobatusers.com/tutorials/list_and_combo_in_lc
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thank you for your reply, i succeed in modifying the code so it becomes :
for Adding to dropdown menu from text field it will be :
//Add current email to DropDown list
var emailvalue = this.getField("emailbyuser").value;
var f = this.getField("EmailList");
f.insertItemAt(emailvalue , "", 0);
and for deleting the selected value from dropdown menu it will be :
//Delete current selected value from emaillist
var f = this.getField("EmailList");
f.deleteItemAt(f.currentValueIndices);
Mohammad Hasanin

