2 Replies Latest reply on Nov 26, 2017 4:22 AM by medos20

    Dynamic DropDown List Add - Delete items

    medos20 Level 1

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



      now the problem is the Add Button JavaScript is not Working! , please help me if it can be done, thanks in advance

        • 1. Re: Dynamic DropDown List Add - Delete items
          Thom Parker Adobe Community Professional

          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.



          1 person found this helpful
          • 2. Re: Dynamic DropDown List Add - Delete items
            medos20 Level 1

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