Skip to main content
Participant
November 25, 2023
Answered

Beginner needs information on drop down menus and fillable pdf forms

  • November 25, 2023
  • 2 replies
  • 861 views

Although it says beginner. I have never done anything with adobe but open something to read. I am considering creating a fillable document and have done some research. The document will have columns, 1st being date, 2nd being Names or Work field, like plumbing etc, third being whatever information is necessary based on name or the field of work chosen from the drop down. I've read about making drop down menus and tried a few things so here are some questions that I have about this:

 

1st question, I will need a drop down menu that has x number of names or work fields, this menu needs to be placed in numerous lines within the column. Is it possible to make only one menu and then place that in the required lines, or must I remake the same menu at each position? That seems like extra work.

 

2nd question:  There is one column in which I need to put drop down menus, when a choice is made can that choice then also put something in the column and on the same line at the right of the menu column? For example, if someone chooses John in the column and line, can the column and line to the right be filled with say a job title or must I make another drop down menu from which that information can be selected?

 

3rd question: Background, the drop down will have the name of say maintenance companies that are always used, i.e. Mountain Maintenance, Sunset, Maintenance and Cleaning, Valley Services, and if making that choice will populate the column to the right, then if the choice is for a new, previously not used company say listed as New Maitenance, or however it is phrased for a company that hasn't been used before can that drop down menu be given the ability to populate the next column to the right with a fillable text box, so the person filling out the form will put in the name and address of the new company in that column to the right?

 

Thanks for any help.

Ruth

 

 

 

This topic has been closed for replies.
Correct answer Nesa Nurani

1. Create one dropdown field, fill it with ('Names'/'Work fields'...etc), when done, select 'Prepare form' tool (if not already selected)
and right click on dropdown field and select 'Create multiple copies' here you can choose how many
copies you want and all of them will already be populated same as first field.
2. There are several easy ways you can do this:
   1. When adding names, set job title as export value for that name, (let's say dropdown field name is "Dropdown1")
      then in text field where you want to show job title,
      use this as custom calculation script:

      event.value = this.getField("Dropdown1").value;
  2. Without setting export value, use like this in text field as custom calculation script:
      var drop = this.getField("Dropdown1").valueAsString;

      if(drop === "John")
     event.value = "Job title for John";
     else if(drop === "Alice")
     event.value = "Job title for Alice";
    //continue adding 'else if' here for other job titles

   else
   event.value = "";//set field to be empty if none of the names are selected.

3. You can show/hide fields if new maintenance is entered in the dropdown, or if those fields will be used by other maintenance also to prepopulate info, then using 'Validation' script in the dropdown will allow users to populate those fields manually.

2 replies

Thom Parker
Community Expert
Community Expert
November 25, 2023

Creating a table filled with fields, with scripts, that interact with each other can be tricky.  

It's best to come up with a field naming scheme that makes it easier to write a single script that for example, will work with the same field on every line. 

Name the fields in a consistent way that fits with how they will be used by the scripts. For example, you've described a row based setup, where changes in one field in a row will affect other fields in the same row. So Use a prefix on all fields in the row, ex: "Row1.FieldCol1",  etc. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
November 25, 2023

1. Create one dropdown field, fill it with ('Names'/'Work fields'...etc), when done, select 'Prepare form' tool (if not already selected)
and right click on dropdown field and select 'Create multiple copies' here you can choose how many
copies you want and all of them will already be populated same as first field.
2. There are several easy ways you can do this:
   1. When adding names, set job title as export value for that name, (let's say dropdown field name is "Dropdown1")
      then in text field where you want to show job title,
      use this as custom calculation script:

      event.value = this.getField("Dropdown1").value;
  2. Without setting export value, use like this in text field as custom calculation script:
      var drop = this.getField("Dropdown1").valueAsString;

      if(drop === "John")
     event.value = "Job title for John";
     else if(drop === "Alice")
     event.value = "Job title for Alice";
    //continue adding 'else if' here for other job titles

   else
   event.value = "";//set field to be empty if none of the names are selected.

3. You can show/hide fields if new maintenance is entered in the dropdown, or if those fields will be used by other maintenance also to prepopulate info, then using 'Validation' script in the dropdown will allow users to populate those fields manually.

Participant
November 25, 2023

Thank you so much. Knowing that everything is possible takes one thing off the plate as I start playing with the form. Have a wonderful day.