Copy link to clipboard
Copied
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 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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
It was indeed due to the "less than" symbol. Many Thanks!