Skip to main content
Participant
November 1, 2020
Answered

If statements on an adobe pdf form

  • November 1, 2020
  • 1 reply
  • 1132 views

Hi.  I was wondering if anybody could help with IF statements on a fillable PDF form?
I have a drop down box which has four options for the person filling in the form to select.  They must choose one option.
When they select one of the options I would like specific text to appear in a box on the form.  So, for example if I select option 1 from the drop down options, the text 'well done blah blah blah' will appear in a text box.  If I select option 2 from the drop down options, the text 'Welcome back' will appear in the text box.  If I select option 3 from the drop down options, the text 'Please take care' will appear in the text box?

Any help appreciated
Thanks

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

Try this in " Custom Calculation Script" of text field:

var drop = this.getField("Dropdown1").valueAsString;
if(drop == "item1"){
event.value = "Some text1";}
else if(drop == "item2"){
event.value = "Some text2";}
else if(drop == "item3"){
event.value = "Some text3";}
else if(drop == "item4"){
event.value = "Some text4";}

Change dropdown field name if needed.

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
November 1, 2020

Try this in " Custom Calculation Script" of text field:

var drop = this.getField("Dropdown1").valueAsString;
if(drop == "item1"){
event.value = "Some text1";}
else if(drop == "item2"){
event.value = "Some text2";}
else if(drop == "item3"){
event.value = "Some text3";}
else if(drop == "item4"){
event.value = "Some text4";}

Change dropdown field name if needed.

BarlaeDC
Community Expert
Community Expert
November 1, 2020

Hi,

 

Just to add to the above, if you have default value, so it if it is not "item1", "item2", or "item3" you want some default text to show you can skip the if and just have

 

if(drop == "item1"){
event.value = "Some text1";}
else if(drop == "item2"){
event.value = "Some text2";}
else if(drop == "item3"){
event.value = "Some text3";}
else {
event.value = "default text";}

 

Regards

 

Malcolm

Andy5DC1Author
Participant
November 2, 2020

Super.  Many Thanks.