Skip to main content
roineoberg
Participating Frequently
April 17, 2020
Question

Dropdown widget does not work

  • April 17, 2020
  • 1 reply
  • 451 views

I am getting an error when using the dropdown widget.

Uncaught SyntaxError: Unexpected token '='

 

Why does it say Adobe Captivate 6 when I inspect the code? Does that mean this widget has not been updated since then? I am using Captivate 9 (11.5.1.499). 

    This topic has been closed for replies.

    1 reply

    Lilybiri
    Legend
    April 17, 2020

    You are using version 11.5, one of the two major releases of CP2019.

    Dropdown widget is pretty old, but is compatible with HTML5 output and is in the Learning Interactions, works pretty well.  What did you put in the list. Here is a blog post dedicated to that interaction

    http://blog.lilybiri.com/dropdown-interaction-tips

    roineoberg
    Participating Frequently
    April 18, 2020

    Hi Lilybiri,

     

    Thank you for the link to the blog post! I will read through it and see if I can figure it out.

     

    The slide has 5 dropdowns with many items in each list. Basically, I need to cram in some 500 job titles on the slide and dropdown widget is the only way I figured that it would be possible. 

     

    For the Add button, the action script looks like this: 

    And the JavaScript to populate the list of interesting job titles look like this:

    try{

    var selR1 = cp.vm.getVariableValue("selectionR1");
    var selR2 = cp.vm.getVariableValue("selectionR2");
    var selR3 = cp.vm.getVariableValue("selectionR3");
    var selR4 = cp.vm.getVariableValue("selectionR4");
    var selR5 = cp.vm.getVariableValue("selectionR5");

    var nSR1 = cp.vm.getVariableValue("sR1");

    var list = [selR1, selR2, selR3, selR4, selR5];

    list.unshift(nSR1);
    list.pop();

    cp.vm.setVariableValue("selectionR1", list[0]);
    cp.vm.setVariableValue("selectionR2", list[1]);
    cp.vm.setVariableValue("selectionR3", list[2]);
    cp.vm.setVariableValue("selectionR4", list[3]);
    cp.vm.setVariableValue("selectionR5", list[4]);

    } catch(error) {
    console.error(error);
    }

     

    What happens is that the error blocks the list from updating. When I open and then close the code inspector in Chrome the list updates so that the last item selected appear at the top of the list, as it should. 

     

    Do you know if there any type of character that is not allowed in a list item, like em dash?

    Lilybiri
    Legend
    April 18, 2020

    I only use JS when it is really necessary, there are JS experts around here, I focus on the advanced/shared actions. Never used JS for any learning interaction, because they are 'closed', have no idea how they were programmed but it was for sure based on Flash.  As you know Flash used AS, not JS. That may be the cause, but it is just guessing. Moreover when I exchange variable values between Captivate and JS, I will use the methods described in the Help about the common API for JS. 

    https://helpx.adobe.com/captivate/using/common-js-interface.html

    If you need a JS solution please create a custom dropdown list. Here is another blog post (again without JS) where you could replace the items by variables populated with JS.

    http://blog.lilybiri.com/more-is-in-a-dot-dot-dot-hyperlink-dropdown-menu