Calling all JavaScripters.........HELP!

Sep 24, 2015

Howdy folks.

I'm hoping that the collective wisdom of this awesome forum can help me out with a JavaScript issue.

Basically, I've got a course where over a number of pages, the learners put some text in to a text entry field.  The text has no predetermined length - it can be a few words or whole paragraphs.

Eventually, they reach a page where all of the text they've entered so far is displayed back to them so that they can tweak it, but as an entire entity.

I've looked around and the best answer I can find is that I have to combine each of the TextEntry variables using JavaScript, then take that combined value and set it as a new variable within Storyline.  You then use that new variable to display the editable text in a new text entry window.

I can get it to work to a point, but the code I've managed to club together only returns the value of the first TextEntry variable, rather than the combined values of TextEntry1-8

Here is the code I've used:

var player = GetPlayer();

var text1 = player.GetVar("TextEntry");
var text2 = player.GetVar("TextEntry1");
var text3 = player.GetVar("TextEntry2");
var text4 = player.GetVar("TextEntry3");
var text5 = player.GetVar("TextEntry4");
var text6 = player.GetVar("TextEntry5");
var text7 = player.GetVar("TextEntry6");
var text8 = player.GetVar("TextEntry7");
var text9 = player.GetVar("TextEntry8");

var text = text1+text2+text3+text4+text5+text6+text7+text8+text9;

player.SetVar("SampleText",text);

I'll edit this post in a bit with a .story file.

Many thanks in advance.

PS - I'm running SL1.....

4 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.