Skip to main content
Known Participant
May 19, 2021
Answered

Insert text field and image after selecting decision from dropdown list

  • May 19, 2021
  • 1 reply
  • 3189 views

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

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

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,

 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
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 depending on choice,

 

Known Participant
May 19, 2021

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

Nesa Nurani
Community Expert
Community Expert
May 19, 2021

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.