Skip to main content
wai_yinh15024341
Participating Frequently
March 7, 2017
Answered

Auto-populated paragraph based on drop-down selection

  • March 7, 2017
  • 1 reply
  • 6558 views

I have a similar question as one of the forum users who ask about auto-populating a scholarship selection criteria text after user select the type of scholarship from a drop-down.  Unfortunately that question was not answered.  For my case, I am developing a continued education event invitation.  Based on the selection from the drop-down list for the course title, I want a course description (around 100 words) to auto-populated in a separate text box.  There is a word limit on the drop down list so I cannot accomplish what I need to do on a drop-down list itself.  I browsed at the past forum and came close to a javascript solution.  I don't know javascript so I cannot modify that solution for my case.  I saw from the actions tab there is an option for import form data.  Will that option help me to do what I need?  Greatly appreciate it!

This topic has been closed for replies.
Correct answer try67

You can do it using a script. As the custom validation script of your drop-down you can use something like this:

if (event.value=="Course 1") this.getField("CourseDescription").value = "Course 1 description...";

else if (event.value=="Course 2") this.getField("CourseDescription").value = "Course 2 description...";

else if (event.value=="Course 3") this.getField("CourseDescription").value = "Course 3 description..."; // etc.

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

Make sure you tick the option to commit the value of the drop-down field immediately so that the text field will update as soon as a selection is made.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 7, 2017

You can do it using a script. As the custom validation script of your drop-down you can use something like this:

if (event.value=="Course 1") this.getField("CourseDescription").value = "Course 1 description...";

else if (event.value=="Course 2") this.getField("CourseDescription").value = "Course 2 description...";

else if (event.value=="Course 3") this.getField("CourseDescription").value = "Course 3 description..."; // etc.

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

Make sure you tick the option to commit the value of the drop-down field immediately so that the text field will update as soon as a selection is made.

wai_yinh15024341
Participating Frequently
March 7, 2017

Thank you very much!  It works! 

Now, I have a similar question but it involves pictures.  Can I do similar script for pictures?  I need to auto-populate the speakers' bio (text) and head shots (photos) based on the speaker selection from another drop-down list.  Thank you very much in advance!

try67
Community Expert
Community Expert
March 7, 2017

Yes, you can do that. The trick is to use button fields to hold the images and then show/hide them based on the selection made.

So let's say you have a button called Image1 and you want to show it when Course 1 is selected (and hide it when it's not, of course). You can use something like this as your validation code:

this.getField("Image1").display = (event.value=="Course 1") ? display.visible : display.hidden;