Copy link to clipboard
Copied
Hi,
I am completey new to forms. I am trying to create a form with a drop down menu on the left, and 9 text boxes to its right that will each have a different value dependant on what is chosen from the drop down menu. There is a tutorial on YouTube that is explaining essentially the same concept. Yet even when I follow that tutorial to the letter, I have a problem where nothing is showing up in the text fields. The drop down menu works fine, but the text fields do not populate.
I have the 'commit selected value immediately' ticked so it isnt that.
Below are screen shots of the initial setup, the code (based on the YouTube tutorial) and the end result
Any suggestions are appreciated!
Copy link to clipboard
Copied
Where did you place script?
If you put script under 'Validate' tab, you need to replace this line:
var dropdownValue = this.getField("JobStep").value;
with:
var dropdownValue = event.value;
Or simply just use: switch(event.value){
Copy link to clipboard
Copied
Hi Nisa,
the script is in the Calculate tab of the drop down menu
Copy link to clipboard
Copied
Can you share your file?
EDIT:
You need to use getField not getfield it's case sensitive.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
So first. Dropdowns are a very popular topic and there are many questions on this forum that are identical to yours.
Here's one article on how to do this:
https://acrobatusers.com/tutorials/change_another_field/
And a page that describes how the dropdown works:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
You're script is close. But it needs to be written differently and placed in the Custom Validation script for the dropdown.
Here's a simple rewrite:
switch (event.value) {
case "Ensure client inductions / permissions are completed":
this.getfield("PotentialHazards").value = "Unauthorized work"
this.getfield("Likelihood").value = "1"
this.getfield("Consequence").value = "1"
this.getfield("RiskScore").value = "2"
this.getfield("Controls").value = "Contact correct site contact for approval"
this.getfield("Likelihood After").value = "1"
this.getfield("ConsequenceAfter").value = "1"
this.getfield("ResidualRisk").value = "2"
this.getfield("PersonResponsible").value = "All Team Members"
break;
}
Since this script will be used in multiple places it would be useful to use table naming for the fields and place the data in an array of objects. This will massively simplify the scripting, make it more robust, and much easier to maintain over time.
PM me if you need help. I provide training/consulting on these types of form issues.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now