I've been trying to add a dropdown menu in bluebeam that can autofill when an option is selected. I found this old answer and it worked perfeclty for the first dropdown menu. But if I want to add a second javascript for another dropdown menu in the same page, the first one stops working. If I add the dropdown menu 2 into the first javascript, it stops working too. What might be an option?
How to make a Drop-down form in a PDF auto-populate a text box [Bluebeam]
this is the script I'm using:
var contarr = new Array() ;
contarr[0] = ["Mexico", "Interior/Exterior", "Status", "Visita"] ;
contarr[1] = ["Ciudad de Mexico, Mexico", "Interior", "Diseño", "Visita: 20 de mayo 2025"]
contarr[2] = ["Chihuahua, Mexico", "Exterior", "En proceso de licitación", "Visita: 30 de junio 2025"]
contarr[3] = ["Cualican, Mexico", "Interior", "En proceso de licitación", "Visita: 20 de julio 2025"]
contarr[4] = ["Tula, Mexico", "Interior", "En proceso de licitación", "Visita: 08 de abril 2025"]
contarr[5] = ["Toluca, Mexico", "Interior", "En proceso de licitación", "Visita: 30 de abril 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Mexico").setItems(names);
this.getField("Mexico").setAction("Keystroke", "onMexicoSwitch(event.value);");
selectMexico(0); // Choose initial contact
function onMexicoSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectMexico(i);
break;
}
}
}
function selectMexico(i) {
this.getField("Interior/Exterior").value = contarr[i][1];
this.getField("Status").value = contarr[i][2];
this.getField("Visita").value = contarr[i][3];
}
;
var contarr = new Array() ;
contarr[0] = ["Guatemala", "Interior/Exterior 2", "Status 2", "Visita 2"] ;
contarr[1] = ["Huehuetenango, Guatemala", "Interior", "Licitación", "Visita: 8 de abril 2025"]
contarr[2] = ["Retalhuleu, Guatemala", "Exterior", "En proceso de licitación", "Visita: 30 de junio 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Guatemala").setItems(names);
this.getField("Guatemala").setAction("Keystroke", "onGuatemalaSwitch(event.value);");
selectGuatemala(0); // Choose initial contact
function onGuatemalaSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectGuatemala(i);
break;
}
}
}
function selectGuatemala(i) {
this.getField("Interior/Exterior 2").value = contarr[i][1];
this.getField("Status 2").value = contarr[i][2];
this.getField("Visita 2").value = contarr[i][3];
}
;
var contarr = new Array() ;
contarr[0] = ["Chile", "Interior/Exterior 3", "Status 3", "Visita 3"] ;
contarr[1] = ["Puerto Montt, Chile", "Interior", "Licitación", "Visita: 30 de abril 2025"]
contarr[2] = ["Viña del Mar, Chile", "Exterior", "En proceso de licitación", "Visita: 20 de agosto 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Chile").setItems(names);
this.getField("Chile").setAction("Keystroke", "onChileSwitch(event.value);");
selectChile(0); // Choose initial contact
function onChileSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectChile(i);
break;
}
}
}
function selectChile(i) {
this.getField("Interior/Exterior 3").value = contarr[i][1];
this.getField("Status 3").value = contarr[i][2];
this.getField("Visita 3").value = contarr[i][3];
}
I've been trying to add a dropdown menu in bluebeam that can autofill when an option is selected. I found this old answer and it worked perfeclty for the first dropdown menu. But if I want to add a second javascript for another dropdown menu in the same page, the first one stops working. If I add the dropdown menu 2 into the first javascript, it stops working too. What might be an option?
How to make a Drop-down form in a PDF auto-populate a text box [Bluebeam]
this is the script I'm using:
var contarr = new Array() ;
contarr[0] = ["Mexico", "Interior/Exterior", "Status", "Visita"] ;
contarr[1] = ["Ciudad de Mexico, Mexico", "Interior", "Diseño", "Visita: 20 de mayo 2025"]
contarr[2] = ["Chihuahua, Mexico", "Exterior", "En proceso de licitación", "Visita: 30 de junio 2025"]
contarr[3] = ["Cualican, Mexico", "Interior", "En proceso de licitación", "Visita: 20 de julio 2025"]
contarr[4] = ["Tula, Mexico", "Interior", "En proceso de licitación", "Visita: 08 de abril 2025"]
contarr[5] = ["Toluca, Mexico", "Interior", "En proceso de licitación", "Visita: 30 de abril 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Mexico").setItems(names);
this.getField("Mexico").setAction("Keystroke", "onMexicoSwitch(event.value);");
selectMexico(0); // Choose initial contact
function onMexicoSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectMexico(i);
break;
}
}
}
function selectMexico(i) {
this.getField("Interior/Exterior").value = contarr[i][1];
this.getField("Status").value = contarr[i][2];
this.getField("Visita").value = contarr[i][3];
}
;
var contarr = new Array() ;
contarr[0] = ["Guatemala", "Interior/Exterior 2", "Status 2", "Visita 2"] ;
contarr[1] = ["Huehuetenango, Guatemala", "Interior", "Licitación", "Visita: 8 de abril 2025"]
contarr[2] = ["Retalhuleu, Guatemala", "Exterior", "En proceso de licitación", "Visita: 30 de junio 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Guatemala").setItems(names);
this.getField("Guatemala").setAction("Keystroke", "onGuatemalaSwitch(event.value);");
selectGuatemala(0); // Choose initial contact
function onGuatemalaSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectGuatemala(i);
break;
}
}
}
function selectGuatemala(i) {
this.getField("Interior/Exterior 2").value = contarr[i][1];
this.getField("Status 2").value = contarr[i][2];
this.getField("Visita 2").value = contarr[i][3];
}
;
var contarr = new Array() ;
contarr[0] = ["Chile", "Interior/Exterior 3", "Status 3", "Visita 3"] ;
contarr[1] = ["Puerto Montt, Chile", "Interior", "Licitación", "Visita: 30 de abril 2025"]
contarr[2] = ["Viña del Mar, Chile", "Exterior", "En proceso de licitación", "Visita: 20 de agosto 2025"]
var names = [];
for (var i = 0; i < contarr.length; i++) {
names.push(contarr[i][0]);
}
this.getField("Chile").setItems(names);
this.getField("Chile").setAction("Keystroke", "onChileSwitch(event.value);");
selectChile(0); // Choose initial contact
function onChileSwitch(name) {
for (var i = 0; i < contarr.length; i++) {
if (contarr[i][0] == name) {
selectChile(i);
break;
}
}
}
function selectChile(i) {
this.getField("Interior/Exterior 3").value = contarr[i][1];
this.getField("Status 3").value = contarr[i][2];
this.getField("Visita 3").value = contarr[i][3];
}
Share
Improve this question
asked Mar 28 at 3:11
Ethel FerraroEthel Ferraro
1
0
1 Answer
Reset to default 0To avoid problems in Acrobat DC or other JS enabled editors like Chromium based Edge or Firefox PDF.js. The Fields should avoid being considered as identical variables.
I have used Interior/Exterior1
Interior/Exterior2
Interior/Exterior3
etc. to avoid any misreading due to common partial names. Thus avoid punctuation in field names such as spaces and even that /
should be avoided.
I have also added the change trigger to the action of leaving the box, and each function is only attached to its own combination field.
This internal programming may only work in standalone modern PDF Reading editors such as AcrobatX or newer (Not Reader 9).
Very much based like several Adobe specific programmable actions, it may not work in Mozilla based PDF.js readers. Since those acrobat clones are not true PDF editors. Thus a different method may be required for that target audience.
It should work well with fast lightweight editors like MuPDF. However It will not be allowed in the one I support (SumatraPDF will NOT run JS neither standalone nor on the web).