Yes, you can do this, I had to do the same for a recent project. Take a look at my comments in this thread to see how to print an html certificate.
To include a name on the certificate, you need to capture the user's name some how in your course and save it to a variable. For example, from a text box.
With the user's name in the variable, it is an easy matter to grab it from javascript, although the syntax is slightly different. Here is the javascript that I would use.
var player = window.opener.GetPlayer(); var userName = player.GetVar('myUserName');
The above javascript assumes that the variable name you used in Storyline what "myUserName". You should change it to match the actual variable name that you used.
Another issue that I noticed was that it is common for the Storyline text box to return a character return, or a line feed which should be remove before you try to add it to your certificate. To do that, you can use this line instead of the one above:
var userName = player.GetVar('myUserName').replace(/(\r\n|\r|\n)/g);
The replace function above is a regExp that will remove the linefeed and character return characters.
Hi Marla! Dave's got some good advice for you above! But I also wanted to let you know that there's a free community download you can try using as well. Here's the link.
3 Replies
Hi Marla,
Yes, you can do this, I had to do the same for a recent project. Take a look at my comments in this thread to see how to print an html certificate.
To include a name on the certificate, you need to capture the user's name some how in your course and save it to a variable. For example, from a text box.
With the user's name in the variable, it is an easy matter to grab it from javascript, although the syntax is slightly different. Here is the javascript that I would use.
var player = window.opener.GetPlayer();
var userName = player.GetVar('myUserName');
The above javascript assumes that the variable name you used in Storyline what "myUserName". You should change it to match the actual variable name that you used.
Another issue that I noticed was that it is common for the Storyline text box to return a character return, or a line feed which should be remove before you try to add it to your certificate. To do that, you can use this line instead of the one above:
var userName = player.GetVar('myUserName').replace(/(\r\n|\r|\n)/g);
The replace function above is a regExp that will remove the linefeed and character return characters.
I hope that this helps.
Hi Marla! Dave's got some good advice for you above! But I also wanted to let you know that there's a free community download you can try using as well. Here's the link.
Cool!
There is always more than one way to do these things.
This discussion is closed. You can start a new discussion or contact Articulate Support.