Highlighted

If statements on an adobe pdf form

New Here ,
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

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.

TOPICS
PDF forms

Views

38

Likes

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

If statements on an adobe pdf form

New Here ,
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

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.

TOPICS
PDF forms

Views

39

Likes

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
Nov 01, 2020 0
Engaged ,
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.

Likes

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
Reply
Loading...
Nov 01, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Nov 01, 2020 1
New Here ,
Nov 02, 2020

Copy link to clipboard

Copied

Super.  Many Thanks. 

Likes

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
Reply
Loading...
Nov 02, 2020 0
Andy5DC1 LATEST
New Here ,
Nov 02, 2020

Copy link to clipboard

Copied

Great.  Thank you.  Works perfectly.  

Likes

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
Reply
Loading...
Nov 02, 2020 0