• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If statements on an adobe pdf form

New Here ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

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

TOPICS
PDF forms

Views

432

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 01, 2020 Nov 01, 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.

Votes

Translate

Translate
Community Expert ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

Super.  Many Thanks. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

LATEST

Great.  Thank you.  Works perfectly.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines