Capture input type date from web object to Storyline 360 variable.

Apr 16, 2022

I'm using HTML input type date to simulate the date picker as a web object in Storyline 360.  

After input, it should check whether the learner selected the correct date or not. 

I'm trying different solutions in previous discussion threads but nothing seems to work. I have tried all the following:

https://community.articulate.com/discussions/articulate-storyline/set-variable-for-storyline-variable-from-web-object

https://community.articulate.com/discussions/articulate-storyline/how-do-you-get-a-web-object-variable-from-storyline

https://www.youtube.com/watch?v=nC34k54fbF8

What Am I missing?

8 Replies
Math Notermans

Although this partially works... i do have to finetune it a bit more to work perfectly.
https://360.articulate.com/review/content/44dd47e4-b3d6-45bc-99ec-3f01352ee6fe/review

First click the button 'pick a Date'...

Then click the input textfield and a datepicker will appear.

Choosing a date and it will show in the inputfield.
As said first have to finetune this a bit more...

 

Saad Siddiqui

This is the code I used for the date.

I insert it as a web object in Storyline 360

I set a variable in Storyline (date_select)

 

<html>
   
<body>
 
**/ Input taken from HTML input tag/**
<input type="date" id="myInput" oninput="updateSLVar()"></input> 
 

<script>

function updateSLVar() {
    var x = document.getElementById("myInput").value;
**/Input value saved in variable x /**
    var player = parent.GetPlayer();
    player.SetVar("date_select",x);
**/Value of variable x passed to Storyline Variable 9date_select)/**
}
</script>

</body>
</html>

This is how it is showing after export from Storyline

https://360.articulate.com/review/content/f6695dbf-378d-4400-beaf-b3a71f2c9aa8/review

Select a date from the date picker by clicking on the calendar icon on the left.

You can see the storyline variable reference showing value in the green rectangle 

I hope this helps.

Thank you.