Skip to main content
March 4, 2018
Question

Is This the Best Script Approach Multi Combo Box Add Lines Spawn Pages

  • March 4, 2018
  • 1 reply
  • 285 views

This script has me baffled and if you have suggestions on the script direction that I should go, I would be eternally grateful and will bake a cake for the correct solution! The goal is to add this script to a page that can spawn additional lines as well as additional pages if needed. But I can’t put the horse in front of the cart. The script I have is not working as I intended for acrobat reader (it works fine on the PC Acrobat DC. There are 4 manufacturers that I have in drop downs/combo boxes, then an additional combo for a brand with selections and yet another combo with color selections. When I save it to document cloud and access the file with an Ipad the script runs fine; but if I change it to another manufacturer or null, it won’t select the brand or color to that manufacturer or even back to null. I am not sure why this is and learned just enough to be dangerous and ask the world of aficionados.

My concern is the current script is not functioning on the mobile device, but also the wrong direction to go when I want to add multiple lines and spawn pages, because a monster file size and an ugly script will surface. I read the section on creating a template which seems to be the direction I need to go to add lines and spawn pages and reduce file size, but I’m skeptical this script is probably not the right one to embed to the template to do that? If anyone with knowledge read through this issue and looked at the script, thanks for staying with me and welcome your assistance!

var f = this.getField("Product Line");

f.editable = true;

switch (event.value){

case "":

  this.getField("Product Line").setItems([""]);

  this.getField("Color Out").setItems([""]);

break;

case "Simonton":

  this.getField("Product Line").setItems(["","Daylight Max","Madeira","Verona"]);

  this.getField("Color Out").setItems(["","Cream","Brick","Bronze","Chocolate","Driftwood","Espresso","Pine","Tan"]);

break;

case "Milgard":

  this.getField("Product Line").setItems(["","Style Line","Tuscany","Montecito","Fiberglass Ultra","Wood Essence","I.G. Insulated Glasspak"]);

  this.getField("Color Out").setItems(["","Ivory","Sand","Fog","Silver","Tweed","Classic Brown","Espresso","Bronze"]);

break;

case "Alside":

   this.getField("Product Line").setItems(["","Mezzo","Fairfield 80","Fairfield 70","I.G. Insulated Glasspack"]);

   this.getField("Color Out").setItems(["","White","Beige","Architectural Bronze","Hudson Khaki","Desert Clay","English Red","Forest Green","American Terra","Castle Gray"]);

break;

case "PlyGem":

this.getField("Product Line").setItems(["","Thin Series 400 2 3/4","Block Series 200 3 1/4","I.G. Insulated Glasspack"]);

this.getField("Color Out").setItems(["","White","Beige","Architectural Bronze","Hudson Khaki","Desert Clay","English Red","Forest Green","American Terra","Castle Gray"]);

break;

}

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
March 5, 2018

I do not believe there are any mobile PDF viewers that implement Page Templates, so forget about that. However, I don't see how that has anything to do with this script. 

Did you check the list of JS objects/functions/properties implemented in the Acrobat Mobile Reader? I do not believe "field.setItems" is on it. This feature does however work in PDF Expert from Readdle, and I believe that is the only mobile reader that it will work on.

In the future please ask a single question, and only provide code that is actually relevant to that question. Keeping it simple helps a lot.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often