Skip to main content
kenth13086284
Participating Frequently
September 7, 2020
Question

Javascript change Incorrect message at runtime.

  • September 7, 2020
  • 1 reply
  • 260 views

Hi Im using captivate for course authoring. For part of the business we want to be able to customize the feedback messages at runtime. I'm trying to look through the cp object and find where that data is stored. cp is quit large. Anyone have an idea where to find this?

    This topic has been closed for replies.

    1 reply

    kenth13086284
    Participating Frequently
    September 7, 2020

    Just in case anyone comes across this in the future. The problem is two fold. 

    1. Captivate stores this data as Images not text. It then renders this to a canvas. It then puts a div on top of that canvas with text for screen readers / accessability. 

    2. The data is not stored in a way that is super distinct from other elements like buttons ect. No unique class name ect.

     

    here is what worked for me. Note this is only for changing the default incorrect message to some other message. This assumes you want to change them all and not have unique fail messages for difference slides.

     

    I needed to do this because my company wanted to change the message across all of our already published courses and opening / re exporting every single course we have in captivate would have taken days.

     

    for (let key in cp.model.data) {
      let value = cp.model.data[key];
      console.log(value.accstr);
    if(value.accstr == "Incorrect - Click anywhere to continue. "){
    value.ip = "https://companywebsite.com/newIncorrectMessage.png"
    value.accstr = "New incorrect message"
    }
    }

     

    Lilybiri
    Legend
    September 7, 2020

    Not astonished, but I wanted to leave this question to the JS experts.

     

    It is easy to circumvent the first problem.  Often I will replace the text in a feedback caption or shape by a variable, to make it easier to change it by shared or advanced actions. That results in a dynamic text container which never is converted to an image. That may give you an idea of editing quickly many feedback messages. But you would still have to open the raw cptx-files.

     

    Was aware of the second problem as well, because the feedback messages are attached to quiz slides, interactive objects. They are no independent items, lack individual IDs like all embedded objects. Same would be the case for many embedded objects on the question slides.

    kenth13086284
    Participating Frequently
    September 7, 2020

    "It is easy to circumvent the first problem"

    In your situation perhaps. But not mine. Our courses are authored by many different people. Some workers in my company. Some sub contractors. Getting them to all do that consistently would be impossible. It's easier this way for our situation.