User defined variables and External JavaScript

Hi there - I am encountering a head scratcher. I am getting an uncaught error in the DEVTOOLS window of Chrome telling me that my user defined variable Var_userID is not defined. As you can see from my screenshot, the Var_userID is used a few times in my page2.html file so the it should be defined by the build.

I've tried my script in many areas, such as Top of file script, Bottom of file script, and even Header scripting.

Discussion (3)

@timk that's a great trick to reset all variables. Now, I do have a TextBox that has an onShowAction that sets the content equal to _userID variable which is what puzzled me. I will give the reset all variables a go and report back.

You have to use the variable in a Lectora action. Otherwise it will not be defined as Lectora believes it is not needed.

You can create a group and add a "Reset all variables" action. Through this all variables are used even if you never run the group.

Sad to report back that it didn't resolve my issue. I think there is a glitch somewhere in there. Either way, I went and acquired the variable via the code below directly in my JavaScript.

var tempUserID = AICC_Student_ID.getValue();

After doing it that way, I was able to get my module working fine.