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!
21 Replies
- AndrewHanleyCommunity Member
@Jürgen - thats hugely helpful to know, thank you. Is this a general JS issue, or specific to Storyline?
- Dave-RuckleyCommunity Member
Looks like I spoke too soon. I started a re-build of the whole thing using the new storyline file and as soon as I added the drug search javascript to it, it kicked up the same issue. So there's something specific about that code that's causing the issue.
UPDATE: It was something to do with undefined data being sent back by the googlesheet, so my friend ChatGPT helped me modify it to catch those and sort them out. It now works perfectly.- Jürgen_Schoene_Community Member
in the current version (58) I get two JavaScript error messages
- fixDigit is not defined
- Prescription_1_End_Date not defined
Import: this are real ERROR-messages (storyline is wrapping the javacript in user js, so it will show only a warning)
- Dave-RuckleyCommunity Member
Try this version: https://360.articulate.com/review/content/40d27177-f851-407c-b51a-3d1e7c8ad99e/review It should go to a blank slide with no loading dots.
- AndrewHanleyCommunity Member
Well, its got no loading dots.... :) It just doesnt have anything at all in way of content now! :P
Console reports a skipped function.Im wondering if you meant to remove the Enter Name and Select Patient dropdown. Is the thing bugging out because it doesnt have any values in those variables now for the XML lookup?
- Dave-RuckleyCommunity Member
I haven't re-built the next slide yet :) that's why it's blank.
As for the other bits, I left those blank for now as I know they work. It was the drug lookup that was causing me issues. - AndrewHanleyCommunity Member
Ah I see, well no loading dots is whats happening, so it seems ok for now.
So it was malformed data coming from the XML? Thats what the console JS warning was hinting at hence I thought it might be the reason.
I wonder if Jurgen's good idea was because of this - forcing the text fields to be implicit data types of single line only? - 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
Excellent info. Thanks for sharing Dave.
Good luck with the project too! o7
Related Content
- 6 months ago