Could you please advise how I can get the system date to display on a certificate. And is there a widget linked to a print button which I can use to print the certificate ?
var currentDate = new Date() var day = currentDate.getDate() var month = currentDate.getMonth() + 1 var year = currentDate.getFullYear(); var player = GetPlayer(); var newName = day + "/" + month + "/" +year player.SetVar("DateValue", newName);
DateValue is my variable in the storyline, it should be a text value
Did you see this Articulate support page on Java Script Best Practices? It includes some content plus a link to a (very good) Brian Batt Screenr on how to insert the current date. I've used it in the past and it's worked for me.
It also includes the JavaScript command for printing the current slide:
thank you very much Rebecca, the window.print() is a screen dump, what I'm looking for a just the print out of the slide. So the user can keep it as a paper copy if required.
Thank you for the links, I will look into them as well. Im sure ill find it helpful.
You might also check out this thread. While it is not directed towards certificates directly, you might find some useful functionality to include user notes in the certificate, printing, and emailing.
I followed the information here and specifically the steps on the this Articulate support page but I cannot get this to work. After I publish the file the slide is blank. I never see the date information. I am not sure what I have done wrong but something is missing, I hope someone can help. The dropbox link below should have the storyline file.
Are you publishing locally? Security restrictions can cause some things to fail when publishing locally.
Can you try publishing to a web server or your LMS, if you have one? Or, if publishing locally, try publishing to CD. Here's a support page with helpful information, including places where you can test published output.
Jeffrey, I tested your file and it works for me, so it must be a security issue as described by Rebecca. I noticed in your Publishing settings that you had the HTML5 publishing for the Mobile Player App option enabled. Just be aware that the Mobile Player App does not support JavaScript.
Thank you. I received a JS error message, however I save the .zip file to the Articulate Tempshare and it worked in that area. How do I get that file work in the actual project without it being an issue for the user.
I'm not sure if Chris is still subscribed here, as the post is a bit older - but you could always use the "contact me" button on a ELH users' profile to reach out to them directly! Best of luck with your project!
Thank you, Owen. We will likely go with creating the certificates in PPT and saving them as pdf then emailing them. That is technology I understand.
For future reference I did try to copy and paste all the JavaScript you supplied into my variable then I published but could not get it to work. FYI, I know nothing about JavaScript.
22 Replies
Hi there I found this which should help
http://community.articulate.com/forums/t/32288.aspx
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear();
var player = GetPlayer();
var newName = day + "/" + month + "/" +year
player.SetVar("DateValue", newName);
DateValue is my variable in the storyline, it should be a text value
Did you see this Articulate support page on Java Script Best Practices? It includes some content plus a link to a (very good) Brian Batt Screenr on how to insert the current date. I've used it in the past and it's worked for me.
It also includes the JavaScript command for printing the current slide:
Print current slide
window.print();
And here a link to a thread with more info on Printing Certificates.
thank you very much Rebecca, the window.print() is a screen dump, what I'm looking for a just the print out of the slide. So the user can keep it as a paper copy if required.
Thank you for the links, I will look into them as well. Im sure ill find it helpful.
regds
N
James Kingsley has a widget that will only print the slide
And just to add a bit of info to Phil's response, here's the link to eLearning Enhanced (I think it's OK to post that here? oh, well...too late now! )
thank you !
You might also check out this thread. While it is not directed towards certificates directly, you might find some useful functionality to include user notes in the certificate, printing, and emailing.
Link to Thread
I followed the information here and specifically the steps on the this Articulate support page but I cannot get this to work. After I publish the file the slide is blank. I never see the date information. I am not sure what I have done wrong but something is missing, I hope someone can help. The dropbox link below should have the storyline file.
DropBox
Hi Jeffrey,
Are you publishing locally? Security restrictions can cause some things to fail when publishing locally.
Can you try publishing to a web server or your LMS, if you have one? Or, if publishing locally, try publishing to CD. Here's a support page with helpful information, including places where you can test published output.
Yes, I have published for CD and Web but I did not try the LMS yet as that takes more time to upload etc. I could try it on my SCORM Cloud account.
Jeffrey, I tested your file and it works for me, so it must be a security issue as described by Rebecca. I noticed in your Publishing settings that you had the HTML5 publishing for the Mobile Player App option enabled. Just be aware that the Mobile Player App does not support JavaScript.
I can't the date to show.
See attached a revised file that fixes several issues with your Javascript(s).
Fantastic, Michael -- thanks so much for assisting Helena here! :)
Thank you. I received a JS error message, however I save the .zip file to the Articulate Tempshare and it worked in that area. How do I get that file work in the actual project without it being an issue for the user.
Once I launched it via the LMS is worked.
Great news, Helena! Thanks so much for sharing an update! :)
Thank you Chris. How do we get the format to change from 5/1/2017 to May 1, 2017?
Hi Ron,
I'm not sure if Chris is still subscribed here, as the post is a bit older - but you could always use the "contact me" button on a ELH users' profile to reach out to them directly! Best of luck with your project!
Thank you for that, Ashley. Message sent.
you need to use an array with the month names. The JavaScript code below created both formats.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
//get the name of the month
var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var currentMonth = month[today.getMonth()];
//create the alternate date as mmmm dd, yyyy
var alternateDate = currentMonth + " " + dd + ", " + yyyy;
//create the standard numeric date as mm/dd/yyyy
//start by creating a leading zero for single digit days and months
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = mm+'/'+dd+'/'+yyyy;
//send the dates to StoryLine variables
var player = GetPlayer();
player.SetVar("SystemDate",today);
player.SetVar("AlternateDate",alternateDate);
Thank you, Owen. We will likely go with creating the certificates in PPT and saving them as pdf then emailing them. That is technology I understand.
For future reference I did try to copy and paste all the JavaScript you supplied into my variable then I published but could not get it to work. FYI, I know nothing about JavaScript.
This discussion is closed. You can start a new discussion or contact Articulate Support.