Solved

Populate a list box with a combobox?

Posted on 2008-10-16
4
1,314 Views
Last Modified: 2012-05-05
Acroforms - Javascript - Adobe Acrobat Pro v8.12

Hello all...

How can I use Acrobat javascript to populate a list box with the values from a combobox (each time values are added to the combobox)?

EXAMPLE:
        Combobox1     Listbox1

        one                   one
        two                    two
        three                 three
           ----------------------
   -User Adds "four" to Combobox1
   
   -Script clears and repopulates
    Listbox1 with all values from
    Combobox1
 
        Combobox1     Listbox1

        one                   one
        two                    two
        three                 three
[Added] four              four

The insertItemAt method isn't really dynamic enough for my needs.

I placed the following Keyboard Script in Combobox2, to populate Textbox2 with the
selection from Combobox2:

var targ1=getField("Textbox2");
if(!event.willCommit){
    targ1.value=event.change;
}

Can it be modified to populate Listbox1 with the Combobox1 values?

Thanks in advance.
0
Comment
Question by:dartanion_jm
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 22757707
Use something like this in the Validate event for your combo box:



var v = event.value;
var items = ["one", "two", "three"];
if (v != "one" && v != "two" && v != "three")
{
    items.push(v);
}
var l = this.getField("ListBox");
l.setItems(items);

Open in new window

0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 500 total points
ID: 22775776
Does my code snippet work for you?
0
 

Accepted Solution

by:
dartanion_jm earned 0 total points
ID: 22782780
Sorry for  the delay. Just checked EE a few moments ago. Will let you know soon. Thanks.
0
 

Author Comment

by:dartanion_jm
ID: 22915841
11/09/08  Sorry for the delay. Khkremer's solution worked. He is "The One".Award all 500 points.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Acrobat’s JavaScript is a great tool to extend the application, or to automate recurring tasks. There are several ways a JavaScript can be added to the application or a document (e.g. folder level scripts, validation scripts, event handling scripts,…
Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question