Skip to main content
michaelm19617145
Known Participant
August 26, 2016
Question

cpQuizInfoAnswerChoice Returning Random Character

  • August 26, 2016
  • 3 replies
  • 694 views

I'm using the cpQuizInfoAnswerChoice variable to allow the learner to view his/her answers to a "Fill in the Blank" question on the Quiz Results screen. Everything seems to be working fine except whenever the user types in a comma (,) when entering their answers, a backslash (\) is shown before the comma (,) on the results screen. For example if they type in "Answer 1, Answer 2, and Answer 3" they will see "Answer1\, Answer 2\, and Answer 3" on their results screen. This only seems to happen when the comma (,) is used. I've tried using different fonts, sizes etc. but still can't get this to go away. I'm thinking it's just an unfixable glitch perhaps? This does not happen when "Text Entry Boxes" are used but I can't use those for my purposes. Thanks.

    This topic has been closed for replies.

    3 replies

    Lilybiri
    Legend
    August 28, 2016

    Both interactions can have a user variable associated. If the LMS is capable of retrieving those variables, which I do not know for Connect, it is OK.

    TLCMediaDesign
    Inspiring
    August 27, 2016

    You may be able to assign cpQuizAnswerChoice to another variable and then remove the "\" to display to the user.

    I'm not sure if this would work in the script window or not, but if you create a variable, in the example below you would replace "yourNewVariable" with the variable you create, then display that variable on the results screen.

    var str = window.cpAPIInerface.getVaraiableValue("cpQuizInfoAnswerChoice");
    window.cpAPIInerface.setVaraiableValue( "yourNewVariable", replaceAllBackSlash( str ) )

    function replaceAllBackSlash( targetStr )
    {
        var index=targetStr.indexOf("\\");

        while(index >= 0)
    {
            targetStr=targetStr.replace("\\","");
            index=targetStr.indexOf("\\");
        }

        return targetStr;
    }

    michaelm19617145
    Known Participant
    August 29, 2016

    Thanks. I tried this but it did not work for me. The variables were not returned on the slide with the results to view. Not sure if this matters but I noticed a few typos in the code you provided that I did fix before pasting into the Script Window of my Captivate (i.e., the words "Variable" and "CpAPIInterface" were spelled wrong). 

    TLCMediaDesign
    Inspiring
    August 29, 2016

    Sorry about the typos!

    I would not run the script in the script window, who knows how Cp will escape all of those characters.

    I tested the script in straight JS then re-wrote it for Captivate. I think that if you put the script in the html file it should work.

    Lilybiri
    Legend
    August 26, 2016

    That will be an escape character, makes me think of JS. Personally I rarely use the FIB question slide because of some limitations, but use either the TEB, the Scrolling Text interaction or the Dropdown interaction to create a custom FIB slide.

    michaelm19617145
    Known Participant
    August 26, 2016

    is there a way to report the Scrolling Text or Dropdown interaction answers to an LMS? We use Adobe Connect and so far I do not see a way to report the answers.