Solved

Populate a list box with a combobox?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Print 2 pages as PDF using Word 8 48
pdf frustration 2 154
pdf file 7 80
PDFBox - convert image to PDF, PDF resolution 3 117
In a previous article published here at Experts Exchange, Signature Image with Transparent Background (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_12380-Signature-Image-with-Transparent-Background.html), I explained how to cre…
*Adobe Acrobat 9 was used for this article.  Particular steps may vary depending on software versions. Adobe Acrobat has many, many variables that my be utilized to customize your forms for clarity and ease of use. The Form Editing Tool will be y…
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
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…

911 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

22 Experts available now in Live!

Get 1:1 Help Now