These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Using ComboBox for navigation

eaclou
Registered: Mar 9 2009
Posts: 5

Hello, I just joined these forums after 2 days of research trying to figure this out, to no avail. I'm pretty new to Acrobat and Javascript, so the more explanation the better.

What i'm trying to do:
-I want to have a Combo Box (made in Acrobat, not LiveCycle) with a number of options, that when you select one it goes to the corresponding page in the SAME .pdf file. So, let's say the combo box has the following entries:
DCA
MHT
MEM
JFK

If the user selects one, it should jump to the corresponding page further into the .pdf

What I have so far:
-in the Properties tab of the Combo Box, under Format, I chose 'custom' and wrote the following in the Custom Keystroke Script: (Mostly for feedback)

if (event.willCommit) {
console.println("Keystroke: willCommit");
console.println("event.value = " + event.value);
console.println("event.change = " + event.change);
console.println("event.changeEx = " + event.changeEx);
} else {
console.println("Keystroke: not Committed")
console.println("event.value = " + event.value);
console.println("event.change = " + event.change);
console.println("event.changeEx = " + event.changeEx);
AirportLink(event.changeEx);
}

I also gave each item in the Combo Box the export value of A1 through A4.

Then, in the Document Javascript (Advanced -> Document Processing -> Document Javascripts) I made the following function, which was called by the Combo Box.

function AirportLink(destination)
{
this.gotoNamedDest('destination');
console.println(destination);
}

I've tried with double quotes, and just simply with the name of 1 particular destination (A3) to test, but nothing works correctly. The correct destination text is printing out in the debugger, so I know that the A1, A2, A3, etc. is being sent to the Document-level function, but It refuses to just go to that page, despite my double-checking that the Named Destinations are set up.

Does anyone know what is going wrong/ a better way to accomplish this?

Thank you very much.

My Product Information:
Acrobat Standard 8.1.2, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Why not assign the destination name for each airport to the export value and then go to the destination value if the value is not a space or empty?

You could also use the "On Blur Action":
if (this.getField(event.target.name).value != ' ') AirportLink(event.value)

George Kaiser

eaclou
Registered: Mar 9 2009
Posts: 5
Thank you, I tried the On Blur action, and it partially worked, but that led me to realize tha there shouldn't be quotes around [destination] because it's a variable. Also I had to use onCommit and value to send the right identifier.

I think i've got something working adequately now.

Thanks again, i'll post again if there are further complications.