Forum Discussion
WebObject to change a variable in Storyline 360
Hi there
I hope some JavaScript wizards can help me with this one!
I have managed to put together a calendar picker plugin and import it into storyline using the Web Object function.
I managed to get the calendar to create the variable "fclickedDate" and report it to the console using the window.console.log(fclickedDate) command in the object.
Now to get it to feed that variable to Storyline......
I tried using parent.GetPlayer() and SetVer("selected_date", fclickedDate) functions in the function but I keep getting an DOM Exception error on the GetPlayer(). PLEASE HELP!
I have zipped the SL file along with a published file and the storyline file. hopefully someone can make some sense of this!
Many thanks
Carrie
- Jürgen_Schoene_Community Member
there is no DOM error
simple type error: selected_date (web object) <-> date_select (storyline file)
result with changed storyline file:
https://360.articulate.com/review/content/43e3a2e5-b884-4c89-904c-5618cb9f1ca6/review
Important for debugging web object:
you have to reimport the web object after every change (there is no auto update) - CarrieWernhamCommunity Member
Thank you so much for the help!
Which browser are you using? I am still getting that DOM error using Edge.
Can you show me the full JS used in that index file?
- CarrieWernhamCommunity Member
It seems to work when published to 360 Review but not when natively on my PC. Is there some security setting I need to change?
- Jürgen_Schoene_Community Member
tested on review 360
- Firefox 106 ok (Windows 7, Windows 10)
- Chrome 106 ok (Windows 7, Windows 10)
- Edge 106 ok (Windows 7, Windows 10)
I have nothing changed in your index.html
to check which version is included, publish to web your .story file from your uploaded zip - PhilMayorSuper Hero
Reread Jurgen's post every time you update the web object outside storyline you must delete the one in the course and import again.
- CarrieWernhamCommunity Member
Thanks everyone
I discovered the WebObject not updating when looking at the coding in the published file. So I have been fiddling with the code of the index.html file on the fly to try and get it to work with the debugger in Edge.It still doesn't work (I get that "DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame" error) when I publish the file to my PC but when I publish it online it works perfectly. There seems to be some security hitch somewhere maybe blocking natively installed files interacting? Or maybe I am launching the course from the wrong file?
No matter though, as long as it works in 360Review and in my LMS when I publish it in my course, that's all that matters!
Thank you so much for your input. I am very shaky on all this JavaScript stuff. I have all these wonderful ideas to make my courses more engaging and realistic (I mostly make software simulation for my training). If I could utilise JS more to make it feel like the actual system the better. Also importing tones of images and shapes in SL bloats the course size and issues with the course loading with our less than perfect network speeds. Screen recordings only get you so far.
- PhilMayorSuper Hero
You cannot test web objects locally, as you have found.
- CarrieWernhamCommunity Member
Thanks Phil! Now I know I can work around that.
Lots of lessons learnt this week in the world of JS.