Script has stopped working

I have a few selector buttons in a Hype document. They have worked fine for four years until a month or so ago. I now get the following error, "TypeError: undefined is not an object (evaluating 'window.myhypedocument.showSceneNamed')"

I have checked for plugin conflicts and everything is up to date. Could it be something to do with the JS update last month?

You can see it at Fire Sprinkler Saves Interactive Map Test – Northern Illinois Fire Sprinkler Advisory Board

Here is the code:

<form name="jump8">

<select name="menu" id="buildingmenu2023" style="font-size : 16px; color: white; background: #4b6bb3;">
<option value="#">BUILDING TYPE 2023</option>
<option value="RESIDENTIAL2023">RESIDENTIAL</option>
<option value="One- or Two-Family Home2023">-- One- or Two-Family Home</option>
<option value="Townhouse2023">-- Townhouse</option>
<option value="Multifamily (condo/apartment)2023">-- Multifamily (condo/apartment)</option>
<option value="Institutional2023">-- Institutional</option>
<option value="EDUCATION2023">EDUCATION</option>
<option value="COMMERCIAL/INDUSTRIAL2023">COMMERCIAL/INDUSTRIAL</option>
<option value="Retail2023">-- Retail</option>
<option value="Office2023">-- Office</option>
<option value="Healthcare2023">-- Healthcare</option>
<option value="Lodging2023">-- Lodging</option>
<option value="Warehouse2023">-- Warehouse</option>
<option value="Manufacturing2023">-- Manufacturing</option>
<option value="Food Service/Sales2023">-- Food Service/Sales</option>
<option value="Assembly2023">-- Assembly</option>
<option value="Other2023">-- Other</option>
<option value="HIGH-RISE2023">HIGH-RISE</option>
<option value="HR Residential2023">-- Residential</option>
<option value="Commercial2023">-- Commercial</option>
<option value="PARKING GARAGE2023">PARKING GARAGE</option>

</select>

<input type="button" id="gobutton20232" onclick="window.myhypedocument.showSceneNamed(document.jump8.menu.options[document.jump8.menu.selectedIndex].value);jump9.reset()" value="GO" style="display:none;">

</form>

<script>

document.querySelector("#buildingmenu2023").addEventListener('change', function() {
document.querySelector("#gobutton20232").dispatchEvent(new Event("click"));
});e

</script>

Where are you setting window.myhypedocument? The issue is it looks like this was never set anywhere.

What are you referring to?

Hi Jonathan, Forgive my ignorance but how do I set that. JS is updated every June, about the time this stopped working.

@jonathan I think what he means is he updates the "JS" in Hype (containing the data).

@dburdick My guess you just uploaded the new nifsabfiresprinklersaves2022q4_hype_generated_script.js or some child Hype file
and not the replaced the entire hype resources folder and now your Hype versions are on a mismatch.

Hi Max, I uploaded the entire folder. Even I reactivate older versions they have stopped working. The people who put out JS update it every June with new features.

My main question is how do I declare window.myhypedocument?

The easiest way would be to add an On Scene Load handler to the first scene that is set to Run JavaScript… with this code:

window.myhypedocument = hypeDocument;

It is pretty odd that it had worked in the past, but not now for some reason even if you go back to the previous version. You would have needed some code like this, or an equivalent, somewhere!

If that doesn't work for you, perhaps you could send a zip of all the files that you use to construct the document? (Like the .hype document and any .html and related files that you might also be using?)

Thanks that worked great.

1 Like