Javascript help

Hello, I've been working up a 50 question assessment and need the content of text boxes to fill an email. I've managed to get this working for the first question but need to figure out the JavaScript for the remaining question responses.

 

Ive set it up so that the feedback box (var fbk = player.GetVar('Question1');)displays the first answer in the email, how would I go about populating multiple questions to form multiple lines within the email please?

This is my script so far:

var player = GetPlayer();
var email = 'your_email@address.com';
var fbk = player.GetVar('Question1');
var subject = 'Course Feedback';
var emailBody = 'Here is some feedback:' + '\n' + fbk;
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');

 

Any advice greatly appreciated :-)

Regards,

John.

6 Replies
Phil Mayor

The limit is about 2000 characters (varies by browser)

This is a post that describes using pdfMake https://community.articulate.com/discussions/articulate-storyline/storyline-360-generating-a-pdf-certificate-using-javascript

Using the documentation you can do pretty much anything. I would use defined pagebreaks otherwise it can get messy. ideally you test it online, if it is your first time building I would test incrementally this way you know when it works and when it stopped working. Also use a "proper" text editor like atom as that will capture most syntax errors.