Vous êtes sur la page 1sur 4

Creating a text entry activity

1. Go to Insert > Data Entry > Text Entry

2.

Draw the text entry box in the slide

3. Note a new trigger is automatically created: Set TextEntry equal to the typed value when the control loses focus. This means anytime the user clicks on anything else on the screen, or navigate away from the screen, the value that they entered will be saved in variable TextEntry 4. For easier management, rename the variable to your own variable, ie. answer1. This is done by:

double-clicking on the trigger:

click on new variable icon

cubicconsulting

Type the name of the new variable and hit OK

Hit OK again to confirm Note: Variable name is case-sensitive

5.

Now well create the workbook link so learners can access it, this is done by either creating a button or put the link on the menu tab. Open workbook via button: Create a button Add a new trigger attached to the button Set the Action to Execute javascript

Click the Script button Copy and paste this code: var newWin=window.open("workbook.html", "workbook", "status=0,scrollbars=0,width=820,height=620");

The workbook will open in a new window when the button is clicked

cubicconsulting

Populating the workbook


1. Open workbook.html with HTML file editor, preferably Notepad++ (http://notepad-plusplus.org/download/v6.3.3.html) 2. Around line 40, you will see: var player=window.opener.GetPlayer(); //pull a field value var q1=player.GetVar("q1answer").replace(/(\r\n|\r|\n)/g, '<br />'); Basically what it does is grabbing the value of variable q1answer from storyline and save it to javascript variable q1. The code is there for example only. 3. Now well change the var q1 to grab the value of the text area that we just created before, so the code will look like this: var player=window.opener.GetPlayer(); //pull a field value var q1=player.GetVar("answer1").replace(/(\r\n|\r|\n)/g, '<br />'); Ive put answer1 in there because our variable name in storyline is answer1. Also please remember that variables are case-sensitive, so if you put Answer1 it will not work. 4. Now we want to display the value of the variable on the workbook by implementing these lines of code: document.write("Your answer:"); document.write("<br>"); document.write(q1); 5. You can change the word Your answer: to anything that you like 6. This is what the code looks like if you have more than 1 text entry field: var player=window.opener.GetPlayer(); //pull a field value var q1=player.GetVar("answer1").replace(/(\r\n|\r|\n)/g, '<br />'); var q2=player.GetVar("answer2").replace(/(\r\n|\r|\n)/g, '<br />'); var q3=player.GetVar("answer3").replace(/(\r\n|\r|\n)/g, '<br />'); var q4=player.GetVar("answer4").replace(/(\r\n|\r|\n)/g, '<br />'); document.write("Your answer:"); document.write("<br>");

cubicconsulting

document.write(q1); document.write("<br><br>"); document.write("Your answer:"); document.write("<br>"); document.write(q2); document.write("<br><br>"); document.write("Your answer:"); document.write("<br>"); document.write(q3); document.write("<br><br>"); document.write("Your answer:"); document.write("<br>"); document.write(q4); 7. Once done, copy workbook.html, publish the storyline project and paste the workbook.html in the published folder

Please note that workbook.html will be erased automatically from the output folder upon publishing the project, so you will need to copy and paste the workbook.html each time you publish the project.

cubicconsulting

Vous aimerez peut-être aussi