Forum Discussion
Slide loading issue
Hi all,
I'm trying to create a simulated prescribing program and am having an issue with one of the slides loading. If you search for "aspirin" on slide 1.3 and then click the first result, it should jump to the next slide which is does, and as far as I can see it populates all the variables that should be populated. However, i'm getting a loading overlay I can't get rid off. In the console I get this error:
TypeError: element.classList is undefined
Uncaught TypeError: t is undefined
But I can't figure out what's causing it.
Here's the review version: https://360.articulate.com/review/content/0ef9c0c2-50c4-4058-addf-fa92fa50a825/review
and the file is attached. Any help would be appreciated!
- Jürgen_Schoene_Community Member
try change the input field from multiline to single line
have a look
- Dave-RuckleyCommunity Member
Jürgen THANK YOU!
It's not worknig in my existing file but when I create a new one to just test this, those loading dots don't appear.
- Dave-RuckleyCommunity Member
It was specifically the code that looked up the search value on a google sheet using the API. It wasn't dealing with empty rows correctly. Here's what ChatGPT said about it:
To avoid the potential issue related to the toString method, you can modify the code to perform additional checks before accessing properties or methods that may result in errors when dealing with undefined values. Here's the modified code:
In this modified version:
Additional checks are added to ensure that data and its properties are not undefined before accessing them.
Before accessing row[0], row[1], row[2], and row[3], checks are added to ensure that they exist and are not undefined. If they are undefined, default values (empty strings) are used to avoid errors.
So now the code has been modified to avoid this and the dots. - AndrewHanleyCommunity Member
I see the symptom happening too.
From your Storyline file you have 2 web objects on Slide 1.4.
It is these causing the issues. You have them set to a local drive and resource, unavailable in Review. - Dave-RuckleyCommunity Member
Hi Andrew, I thought about that so I initially removed them but the issue continued. If you go directly to 1.4 you'll see they load no problem.
- AndrewHanleyCommunity Member
Yeah, but its the order of their loading maybe?
Storyline JS is notorious for loading things slowly or incorrect order than what is logical.
Can you load these web objects on a blank slide called from 1.3, then listen for the data being received, and then go to 1.4?
- AndrewHanleyCommunity Member
Also.... I had a quick look over the rest of the JS, and there is a lot of duplication happening.
Maybe consider using seperate JS calls for setting of the variables, and parsing of the XML data. It will mean you eliminate any duplication, which is going to make future code changes/additions much much easier. - Dave-RuckleyCommunity Member
I added a new slide (with the web objects and without) and it's the same. Something happens between when you click on one of the search results and the loading of whatever the next slide is regardless of its content
- AndrewHanleyCommunity Member
OK. I'll have another look...
- AndrewHanleyCommunity Member
Assuming those web objects arent the issue, then the Developer Console messages are telling me that the JS is failing to find necessary data. So, the next place I would look is the XML data itself. Check that every one of your JS var sets on each slide are definitely correct.
I believe you may have got one of the JS variables incorrectly set - maybe accessing the wrong level/node/child from the XML?
Without being able to see the XML its impossible for me to know for sure, but I would manually trace out to the console each JS variable after setting it from the XML, that will tell you for sure if its set correctly.Good luck! :)
- Dave-RuckleyCommunity Member
Thanks Andrew. I've updated the review version to include the XML files and it all seems to pull in the data correctly but the problem is still there. I'm sure it's something tiny but for the life of me I can't see an issue!
- AndrewHanleyCommunity Member
Always hate problems like this when I'm coding. Horrible to find, and 99% of the time something small and innocent looking.
Like you, I cant see anything inherently wrong with the Storyline file you sent.
If the web objects arent the issue, and all the JS and XML variables are lining up correctly, then Ive no idea. (sorry!)Could it be one of those annoying SL bugs on a slide? Sometimes you have to create a brand new project to get rid of those.
WHile it's annoying, if it was my project, this is what I would do - start a new project, and only focus on the bit you know is the problem - pulling in the XML data for "aspirin", and setting start and stop dates accordingly.
If that works, then start building around it, if not, at least you've confirmed the problem is that exact thing.Sorry I cant be of more help on this one!