Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Load array content into listbox learner interaction

Community Beginner ,
Sep 08, 2017 Sep 08, 2017

Hi everyone,

I've read a bit about listboxes online, but I still cannot find out, how to load an array into a listbox widget (I chose the one from learner interactions in Captivate 10). The listbox states a variable that I named listbox_own, but it only saves the choice of the user in this variable. However, I want to load the content from a variable. Is that possible?

 

I've tried as onload event on the slide the following, but it doesn't work

var myArray = [ "cat", "dog", "snake"];

window.cpAPIInterface.setVariableValue( "listbox_own", myArray);

 

Best regards 
Max

182
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2017 Sep 08, 2017

Indeed, that variables is only used to store the result of the choice by the learner. It cannot be used to populate the items in the listbox.

What do you want to do with the listbox? Maybe you misunderstand its purpose.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 08, 2017 Sep 08, 2017

I want to add all the items from an array, and load the content for the array from an external file. Is there any other way to do this?

 

Thanks for your quick reply!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2017 Sep 08, 2017

You will need to look for another solution, create your own list with each item being an inserted user variable. Then it is possible to use the interface to populate those variables. You cannot just use a complete array to fill something, you'll need to write a function that puts each of the elements of the array in a different variable.

You didn't answer my question: what do you want to do with that listbox in Captivate? It is meant as an alternative for the radio buttons widget, where the learner will chose an item and based on that item another action will occur.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 08, 2017 Sep 08, 2017

Thank you for your answer. 

"what do you want to do with that listbox in Captivate? It is meant as an alternative for the radio buttons widget, where the learner will chose an item and based on that item another action will occur." 

I want users to choose items, however I want to load the content dynamically from a file and populate the listbox with it, so that I can change the content of the listbox without further changes in captivate by just changing the file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2017 Sep 08, 2017
LATEST

I don't know about a way to populate those items, the source code of that widget is not available.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources