Hi TomG, my requirement is to add few hidden variables in the page/block with an open ended question, when the next button is clicked, submit the values of open ended text area and the hidden variables to third party api, set the response values from third party api into embedded data. Can you elaborate more on the suggestion you were providing with web service?
Thank you TomG. Was aware of this and tried many times earlier. Always giving "undefined". Working on clickNextButton() made me realize that "this" is undefined within your js functions. You need to declare it outside of functions as var that = this and use that.questionId within your javascript functions.
Never mind, I got that resolved. this.hideNextButton(); var that = this; variable "that" should be initialized when hideNextButton() is called.
Not sure on the web service from survey flow, but for now, I am trying to use an empty page/block(a descriptive question asking survey responses to hang on), store response from previous page/block in session, hide next button, submit them in page load and click next button when response is received. If that does not work out, I will go with web service call. Thanks a lot, TomG.
I tried doing that but next page loads before i receive response from the third party API I am calling. I need to stop navigating to next page until i receive the response(success) from the other api.
Below is the code snippet I am trying to do: Qualtrics.SurveyEngine.addOnUnload(function(type) { var clientId = 'ClientId'; var userId = 'UserId'; var password = 'password'; var surveyId = "${e://Field/SurveyID}"; var responseId = "${e://Field/ResponseID}"; var pageId = "P1"; var matrixData = getMatrixData(); CollectData(clientId, userId, password, surveyId, responseId,pageId,matrixData); function getEngagedResult(jsonData) { if (jsonData.Success) { alert(jsonData.Success); //The page submit should wait till this block is reached } else { // check jsonData.ErrorMsg } } });
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.