Skip to main content
Participating Frequently
February 18, 2023
Answered

Populating a text field from responses in Dropdown

  • February 18, 2023
  • 2 replies
  • 10893 views

Hello,

I realize there are many posts like this one and this is a pretty common question, but it seems like each situation requires a different approach. I want a paragraph to be filled out using choices made from a drop-down list of Ed codes.

 

For Example:

If the drop down selection is:  Section 48900 Subdivision(c) 

Then I want a Text Filed to popluste with "Unlawfully possessed, used, sold, or otherwise furnished, or been under the influence of, a controlled substance listed in Chapter 2 (commencing with Section 11053) of Division 10 of the Health and Safety Code, an alcoholic beverage, or an intoxicant of any kind."

and if  the drop down selection is:  Section 48900 Subdivision(d) 

Then I want a Text Filed to popluate with 

" Unlawfully offered, arranged, or negotiated to sell a controlled substance listed in Chapter 2 (commencing with Section 11053) of Division 10 of the Health and Safety Code, an alcoholic beverage, or an intoxicant of any kind, and either sold, delivered, or otherwise furnished to a person another liquid, substance, or material and represented the liquid, substance, or material as a controlled substance, alcoholic beverage, or intoxicant."

 

I have more Ed codes to add but I started now with only 2

 

I appriecate yoru help to figure this out

Best,

Dan

 

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

Don't use same quotes within quotes.

Use like this: 'imitation firearm'

or escape them with backslash \"imitation firearm\"

2 replies

Nesa Nurani
Community Expert
Community Expert
February 18, 2023

Use this as 'Validate' script of dropdown field (add more conditions before last 'else'):

if(event.value == "48900 subdivision(c)")
this.getField("Text2").value = "Unlawfully possessed, used, sold, or otherwise furnished, or been under the influence of, a controlled substance listed in Chapter 2 (commencing with Section 11053) of Division 10 of the Health and Safety Code, an alcoholic beverage, or an intoxicant of any kind.";

else if(event.value == "48900 subdivision(d)")
this.getField("Text2").value = "Unlawfully offered, arranged, or negotiated to sell a controlled substance listed in Chapter 2 (commencing with Section 11053) of Division 10 of the Health and Safety Code, an alcoholic beverage, or an intoxicant of any kind, and either sold, delivered, or otherwise furnished to a person another liquid, substance, or material and represented the liquid, substance, or material as a controlled substance, alcoholic beverage, or intoxicant."

else
this.getField("Text2").value = "";

Here is your file with script added:

https://drive.google.com/file/d/1dctOsnWkdTObj-blMoSsC4N50GI8Sh2f/view?usp=share_link 

Participating Frequently
February 18, 2023

WOW,

Nesa, Thank you soooooooooooooo VERY MUCH! You are amazing. I really appreciate your help. God bless you

 

Participating Frequently
February 18, 2023

I have attached a pdf sample