how can I add a submit button to end the survey at any point in a block and a next button to move to the next block | XM Community
Skip to main content

Hello there,

 

I am trying to figure out how to add a submit button and a next button to each block on my survey. Multiple parties would use this form to add information to this survey.

 

Here is what I am trying to do:
 

Block 1:

 

  • Question 1: What is your name?
  • Question 2: What is your age?
  • Submit Button: Ends the survey
  • Next Button: Moves to Block 2

 

Block 2:

 

  • Question 3: What is your favorite color?
  • Question 4: What is your favorite food?
  • Submit Button: Ends the survey
  • Next Button: Moves to the End of Survey page

Any suggestions?

 

 

For Block 1, use JS to add the Submit button and when it is clicked set an embedded data field and click the Next button.  After Block 1 add survey flow branch based on the value of the embedded field.

For Block 2, use JS to add the Submit button and when it is clicked click the the Next Button.


@TomG will it be something like this?

 

// Add a submit button
var submitButton = document.createElement("button");
submitButton.type = "button";
submitButton.innerText = "Submit";
submitButton.id = "submitButton";
document.getElementById("NextButton").parentNode.insertBefore(submitButton, document.getElementById("NextButton"));

// Add click event listener to submit button
submitButton.addEventListener("click", function() {
  // Set embedded data field value
  Qualtrics.SurveyEngine.setEmbeddedData("your_embedded_data_field_name", "submitted");
  // Click next button
  document.getElementById("NextButton").click();
});

 

In block 1 I want the respondent to click a button that says submit or one that says continue to next section


Yes, something like that. You need to put it inside the addOnReady function.


Leave a Reply