Dynamically creating a drop down list with related data | XM Community
Skip to main content
Solved

Dynamically creating a drop down list with related data

  • January 5, 2022
  • 3 replies
  • 244 views

Forum|alt.badge.img

We are trying to create a training registration form that allows the user to select a specific training from a drop down list. Each training has an associated unique training ID. We would like to capture the ID of the selected training and send it to a custom API we have developed when the survey is completed.
I have seen two examples that show how to populate a drop down using a file/API call, but I don't see how we could include an associated training ID, which is required by our API to complete the training registration.
For example:
1) The survey loads the data for the drop down from a webhook or flat file
2) User selects training they want to register for
3) User completes survey
4) Webhook sends the training ID for the selected training to our API

Best answer by ahmedA

You could use select 2 for displaying the training names. Then, use JS to map those names to the ID and store that as an embedded variable.

3 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • January 6, 2022

You could use select 2 for displaying the training names. Then, use JS to map those names to the ID and store that as an embedded variable.


Forum|alt.badge.img

Now I just need to figure out what select 2 is! :-)


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 6, 2022

Getting Started | Select2 - The jQuery replacement for select boxessearch the community. Lots of examples related to Select2.