Solved

Populate a list box with a combobox?

Posted on 2008-10-16
4
1,315 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Notification massage in SharePoint 2010 5 71
PDF: Display my cards game? 8 126
Adobe Reader Viewing Issue 1 64
Sources to create infographic resume 2 21
This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
*Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

808 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