Highlighted

Select an item from a drop-downs list and display a text in a text field based on selection

New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

Hello, 

 

I am building a form and I have a dropdown list called "items" and I would like to know what javascript I need to display a message in "TextFiled1" when some items are selected and nothing when other items are selected.

Could someone help me with this task please?

TOPICS
PDF forms

Views

25

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

Select an item from a drop-downs list and display a text in a text field based on selection

New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

Hello, 

 

I am building a form and I have a dropdown list called "items" and I would like to know what javascript I need to display a message in "TextFiled1" when some items are selected and nothing when other items are selected.

Could someone help me with this task please?

TOPICS
PDF forms

Views

26

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
Oct 30, 2020 0
Engaged ,
Oct 30, 2020

Copy link to clipboard

Copied

If i understand you right, you can use code like this.

var drop = this.getField("items").valueAsString;
if(drop == "item1"){event.value = "some text";}
else if(drop == "item2"){event.value = "";}

Put code in textfield "custom calculation script" of course you need to adapt code to your needs.

 

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...
Oct 30, 2020 0
New Here ,
Oct 31, 2020

Copy link to clipboard

Copied

This is exactly what I needed, thank you so much!

Have a nice weekend!

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...
Oct 31, 2020 0