Dynamic DropDown List Add - Delete items

Nov 24, 2017

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

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);

TOPICS
Acrobat SDK and JavaScript, Windows

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Dynamic DropDown List Add - Delete items

Nov 24, 2017

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

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);

TOPICS
Acrobat SDK and JavaScript, Windows

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 24, 2017 0
Nov 24, 2017

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 24, 2017 2
Nov 25, 2017

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);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 25, 2017 0