Solved

Populate a list box with a combobox?

Posted on 2008-10-16
4
1,311 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Getting information about Fonts being used in a PDF file A colleague of mine recently faced an issue related to the PDF file format. The PDFs were containing mission critical client information, they were successfully mailed but there was a sm…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
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…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now