Cannot read property 'addEventListener' of null

When importing the sample Style Example with HTML Navigation from https://hclwiki.atlassian.net/wiki/spaces/HDV/pages/552566834/Building+Apps+with+Style and previewing the form I get the above error whenever I tried to click on any of the navigation menu. These are the code that run on the onClick event of that menu

var home = document.getElementById('home');
home.addEventListener("click", function (event) {
page.F_HomeSection.setVisible(true);
page.F_ChoiceASection.setVisible(false);
page.F_ChoiceBSection.setVisible(false);
page.F_ChoiceCSection.setVisible(false);
})


var choiceA = document.getElementById('choiceA');
choiceA.addEventListener("click", function (event) {
page.F_HomeSection.setVisible(false);
page.F_ChoiceASection.setVisible(true);
page.F_ChoiceBSection.setVisible(false);
page.F_ChoiceCSection.setVisible(false);
})

var choiceB = document.getElementById('choiceB');
choiceB.addEventListener("click", function (event) {
page.F_HomeSection.setVisible(false);
page.F_ChoiceASection.setVisible(false);
page.F_ChoiceBSection.setVisible(true);
page.F_ChoiceCSection.setVisible(false);
})

var reviewSubmit = document.getElementById('reviewSubmit');
reviewSubmit.addEventListener("click", function (event) {
page.F_HomeSection.setVisible(false);
page.F_ChoiceASection.setVisible(false);
page.F_ChoiceBSection.setVisible(false);
page.F_ChoiceCSection.setVisible(true);
})

Since I have not change anything on the example, is there any global setting that I must enable for this to work ?

Tinus Riyanto - Prisma Global Solusi

Are you trying to run that app on the Volt Sandbox? If so, that would explain the error message.

The secureJS=true setting (JS is sandboxed) does not allow listeners to be assigned to elements in your page. The HTML navigation code is all based on onClick listeners so its not going to work in the Sandbox.

This example will run in the Sandbox Style Example with Side Navigation and essentially does the same thing. It uses Volt eventing and JS functions.

Thanks Marty,

Since I deploy these examples on our company's server (Volt 1.0.1), I have modified the secureJS setting on Volt Config nsf to False and remove the example 3 (HTML Side Nav) apps and re-import it. However I still got the same error. Is there anything else I need to do to get that secureJS setting propagated properly ?

I prefer to use example 3 because the navigation menu will automatically move itself to the top is the screen is resized beyond a certain point.