Skip to main content
Participant
December 22, 2022
Question

Select dropdown option, show a textfield, empty textfield shows dropdown options again

  • December 22, 2022
  • 2 replies
  • 4489 views

Hi

 

I'm pretty new to Adobe Forms /  Javascript so go easy on me! 

 

I have a drop down called "Shipping Type" with 3 options - Pallets, Loose, Other. 

On selection of Other I would like a textbox (called "ST-Other") to show where the Dropdown was with default text - Please Specify Requirments 

If you backspace all text from the textbox I want the Dropdown options to show again. 

 

Is this possible? 

 

Along with the javascript, please let me know if i need to enable any Actions as well? On mouse focus? blur? etc? 

 

Thankyou! 🙂

This topic has been closed for replies.

2 replies

Nesa Nurani
Community Expert
Community Expert
December 22, 2022

Use this as 'validation' script of dropdown field:

if(event.value == "Other"){
event.target.display = display.hidden;
this.getField("ST-Other").display = display.visible;
this.getField("ST-Other").value = "Please Specify Requirments";}

 

Use this as 'Validation' script of text field:

if(event.value == ""){
event.target.display = display.hidden;
this.getField("Shipping Type").display = display.visible;}

try67
Community Expert
Community Expert
December 22, 2022

I would not recommend you do that. It can be quite confusing for the user. You should create the text field next to the drop-down and show/hide it as needed.