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

Insert text field and image after selecting decision from dropdown list

New Here ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

I am completely new here, so apologies for that.

I have made very basic forms for my work place and now I would like to step up my games a little.

I have an safety inspection sheet I want to develop that has a drop down for YES, NO and N/A. If NO is selected, I need to insert a text field and a place to capture an image; I would need each condition to colour the dropdown after selection. I have attached a page of one I do longhand in word.

See, I made that sound easy! 😉

I have some experience concatenation of text, but that is as far as it stretches, any help would be appreciated.

Thanks

TOPICS
How to , JavaScript , PDF forms

Views

1.7K

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 , May 19, 2021 May 19, 2021

You can make text field and image field in advance and hide it until selection is made in dropdown field. You will need script for it, something like this as validation script of dropdown field:

if(event.value == "NO"){
this.getField("Text field").display = display.visible;
this.getField("Image field").display = display.visible;}
else {
this.getField("Text field").display = display.hidden;
this.getField("Image field").display = display.hidden;}

You will also need script to change dropdown color depen

...

Votes

Translate

Translate
Community Expert ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

You can make text field and image field in advance and hide it until selection is made in dropdown field. You will need script for it, something like this as validation script of dropdown field:

if(event.value == "NO"){
this.getField("Text field").display = display.visible;
this.getField("Image field").display = display.visible;}
else {
this.getField("Text field").display = display.hidden;
this.getField("Image field").display = display.hidden;}

You will also need script to change dropdown color depending on choice,

 

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

Thank you Nesa, that was super-quick and works perfectly well.

I have adapted this to now add additional images as required, like so

 

if(event.value == "NO"){
this.getField("Text3").display = display.visible;
this.getField("Image4_af_image").display = display.visible;
this.getField("Image5_af_image").display = display.visible;
this.getField("Image6_af_image").display = display.visible;}
else {
this.getField("Text3").display = display.hidden;
this.getField("Image4_af_image").display = display.hidden;
this.getField("Image5_af_image").display = display.hidden;
this.getField("Image6_af_image").display = display.hidden;}

 

Now just need to find the colour change script.

 

Thank you

Mark

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

What do you want to change border or fill?

Here is sample to change border of dropdown field:

if(event.value == "N/A")
event.target.borderColor = color.black;
else if(event.value == "NO")
event.target.borderColor = color.red;
else if(event.value == "YES")
event.target.borderColor = color.green;

 

To change fill color, replace border with fill.

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

Wow, you are awesome, and very helpful.

One last thing, if you can help me.

How would I get the lines to sit below one another if the YES condition was met, obviously the NO condition would need the line below to move down to accomdate the text and the image.

Regards

Mark

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

TIP: in dropdown field -> option tab check " Commit selected value immediately" so the script is executed as soon as you select value.

What lines? Sorry I'm not sure what you mean.

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

Hi Nesa

Is there a way I can tighten the lines up if the YES condition is reached, I have attached the PDF with an example. Example 1 and 2. So if YES is selected, it moves to the line below without padding, If NO is selected, then it move subsequent lines down to insert text and images.

 

Regards

Mark

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
Enthusiast ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

LATEST

If I understand it right, you want to move or create new fields depending on an answer so you don't have big empty space if "YES" is selected,unfortunatelly there is no easy way to do it in acrobat.

I would advise to keep empty space with hidden fields, it would leave you with empty space if "YES" is selected but is much easier then alternative of making very complicated script for which you would probably need to hire some1 to do it for you.

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