Skip to main content
Participant
November 9, 2017
Answered

Javascript ist not being saved in the advanced actions

  • November 9, 2017
  • 1 reply
  • 389 views

Hello,

I have a problem in Captivate 2017 with Javascript and the advanced actions. The script is not being saved and discarded when the script window is closed. It works only if I create the script as a single action.

Can someone tell me why that is?

This is my code:

var Daten = [raum_bez, pers_nam_a, pers_pos_a, pers_mail_a, pers_tel_a, pers_note_a, pers_nam_b, pers_pos_b, pers_mail_b, pers_tel_b, pers_note_b, pers_nam_c, pers_pos_c, pers_mail_c, pers_tel_c, pers_note_c, pers_nam_d, pers_pos_d, pers_mail_d, pers_tel_d, pers_note_d];

var Belegung = [["eg-3", "EDV", "Test Person", "IT Management", "test.person@web.de", "0208", "Nur nachmittags ansprechbar", "Ano Nym", "IT Management", "ano.nym@gmx.de", "0202", "Ansprechpartner für Hardwareprobleme", "John Donym", "IT Management", "john.donym@gmx.de", "0201", "Ansprechpartner für den schwarzen Peter", "Hans Mustermann", "IT Management", "hans.mustermann@gmx.de", "0200", "Ansprechpartner für Datenbanken"], ["eg-5", "Training", "Test Person 2", "E-Learning Designer", "test.person.2@gmx.de", "0118", "-", "Else Dummy", "Trainerin", "else.dummy@web.de", "0112", "-", "", "", "", "", "", "", "", "", "", ""]];

var raum = window.cpAPIInterface.getVariableValue("raum_index");

for (var i = 0; i < Belegung.length; i++) {

        if (Belegung['Index'] == raum) {

    for (var i2 = 0; i2 < Daten.length; i2++) {

window.cpAPIInterface.setVariableValue(Daten[i2],Belegung[i2+1]);

}

        }

    }

This topic has been closed for replies.
Correct answer Jim Leichliter

This is a known issue... and if my memory serves me right, I believe it has to do with "less than" symbols in the code... in your "for" loops.  Best solution is to write your own JS in an external file and add that as a reference (script tag) in your HTML published output. Or... rewrite your JS code to exclude the less than symbols.

1 reply

Jim LeichliterCorrect answer
Legend
November 9, 2017

This is a known issue... and if my memory serves me right, I believe it has to do with "less than" symbols in the code... in your "for" loops.  Best solution is to write your own JS in an external file and add that as a reference (script tag) in your HTML published output. Or... rewrite your JS code to exclude the less than symbols.

K3hr3rAuthor
Participant
November 10, 2017

It was indeed due to the "less than" symbol. Many Thanks!