Forum Discussion

SylviaWright's avatar
SylviaWright
Community Member
19 hours ago

SystemDate variable not working

I have a systemdate variable in my project certificate and it is not working. It is a text variable with the trigger "Execute Javascript when the timeline starts on this line" The javascript is

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var dateString=month + "/" + day + "/" + year
var player = GetPlayer();
player.SetVar("SystemDate",dateString);
player.SetVar("month",month);
player.SetVar("day",day);
player.SetVar("year",year);

It will not show up in my published test certificate :(. Help please???

 

I'm also getting the message "Skip Navigation. Hit enter to return to the slide" on almost all of my buttons. It's like nothing is lining up correctly???

3 Replies

  • DShaw's avatar
    DShaw
    Community Member

    Your JavaScript is correct so its not that… I would check your variable name make sure it is exactly the same (its case sensitive so must be SystemDate) make sure there are no trailing spaces. Also check the same on your cert reference (must be %SystemDate%)… are you viewing in preview or published output?

  • DShaw's avatar
    DShaw
    Community Member

    To fix the skip navigation message try: 

    From Home tab - Player - click “Other” on the ribbon - tick “Disable skip navigation shortcut.” Then republish and it should be gone. If its gone this confirms what the message was so you can turn this setting back on knowing it wasn't a bug that your course will ship with. 

  • I would not disable the skip navigation shortcut. That is a critical item for screen reader users navigating via keyboard who tab through the slide using the Tab key on their keyboard and when they get to the end of the slide, the Skip Navigation will bring them back to the top.

    The Javascript itself looks fine, so I'd check:
    1. Did you create the Text Variable and is it called SystemDate

    2. Do you have a text box with a reference to that SystemDate variable on your slide?

    3. Is the trigger to execute the Javascript on the base layer?

    Feel free to post a screenshot if you can!