I had a user put a ticket in yesterday that I'm stumped on and wondered if anyone could spot my problem at a glance.
Code
`<p style="text-align: center;"><em><span style="font-size: 32px;"><strong>Inpatient Nursing Unit Characteristics Survey</strong></span></em><br />
</p>
// New Header, Next, and Previous buttons
<div id="New" style="text-align: right; ">
<input id="PreviousButton" type="submit" value="Back" name="PreviousButton" title="Back"
onclick="Qualtrics.SurveyEngine.navClick(event, 'PreviousButton')">
<input id="NextButton" type="submit" value="Next" name="NextButton" title="Next" onclick=
"Qualtrics.SurveyEngine.navClick(event, 'NextButton')">
<style>`
Backstory
This code worked in mid-July at the very least; trying to figure out what broke it. I can re-code this ~4 different ways to accomplish the same task, but I want to know why it's broken now, as it looks to me like nothing's wrong. This code puts two custom buttons in the header of the survey, a next and a back, of course. These buttons are throwing a reference error: "Qualtrics is not defined at HTMLInputElement.onclick ([mySurveyId])", so Chrome (also tested in Firefox and IE with same results) doesn't know what _Qualtrics[.SurveyEngine.navClick]_ is or what it's referencing. The JS variable _This_ is 'undefined' any way I run it because the scope is above a specific question level.
I dug into the JSON WebPack file attached to the default >> Next Button and found the reference to the navClick function call:
`navClick: function(event, buttonName) {
return event = $.Event(event),
"NextButton" == buttonName && Page && Page.next(),
"PreviousButton" == buttonName && Page && Page.prev(),
event.preventDefault(),
!1`
I can't say I understand all of this, but I understand the logic behind it. To me, the onclick event looks correct, but the browser doesn't know how to interrupt Qualtrics Class APIs. Another thing I should mention, this survey has a Table of Contents 3 pages in (after a password entry page and a welcome page), and once inside the ToC, the custom buttons work fine. The default buttons are being hidden for reasons I'm not sure why; I believe they are using them as a "Master Submit" button. For the sake of testing, I commented the code to hide these, but I can't use them in my solution. Any wisdom as to why the custom buttons don't work on the first two pages? Anything you can offer would be much appreciated, thank you! I'd be happy to provide more info as needed!
- Jeremy