How to add a back button to a specific block. | XM Community
Solved

How to add a back button to a specific block.

  • 16 October 2018
  • 18 replies
  • 1076 views

How do you add a back button to a specific block?
icon

Best answer by TomG 17 October 2018, 01:40

View original

18 replies

Userlevel 6
Badge +18
@GradStudent4 ,

I would suggest you to try Table of content.
Hope it might help.
Userlevel 7
Badge +27
Turn on the back button for the survey and hide it using JavaScript everywhere you don’t want it.

I would put a single script in the header that uses an embedded variable to specify if the back button should be shown or not.
Thank you! I am new to using java script. Is there a generic script I could use and if so, where to place it? Just in the Java script section?
Userlevel 7
Badge +27
You can use this script added to the Look & Feel Header (in <> mode):
```
<script>
Qualtrics.SurveyEngine.addOnReady(function() {
if(!!+"${e://Field/hidePrev}") jQuery("#PreviousButton").hide();
});
</script>
```
Set the embedded variable hidePrev to 1 to hide the back button, and leave blank or set to 0 to show the back button.
Hi @TomG ,
Like Gradstudent4, I am new to java script. Could you please provide a bit more details? Do you add this script per question in the java script section (and where)? I can add the script to the look and feel header, but how to you adapt this per block?
Thank you,
Userlevel 7
Badge +27
> @lostinqualtrics said:
> Hi @TomG ,
> Like Gradstudent4, I am new to java script. Could you please provide a bit more details? Do you add this script per question in the java script section (and where)? I can add the script to the look and feel header, but how to you adapt this per block?
> Thank you,
>
Place the JS in the header. In your survey flow, set the embedded variable hidePrev to 1 before any block(s) where you want to hide the Next button. Set hidePrev to 0 before any block(s) where you don't want hide the Next button.
Badge +3
Hi,

I tried to do as you said, but it only displays the back button at the very moment I press the Next button in the given block. Which makes the back button unusable... Do you know how to fix that?
Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/8858#Comment_8858I did this and it only hides the button for the first 2 pages of the block. For pages after that, the script still shows up in the header when I inspect it but the back button is clickable... any ideas? thank you

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/43532#Comment_43532It sounds like a timing issue. Make sure you use addOnReady() and turn off page transition. If it still doesn't work you may need to put the hide command in a setTimeout function.

Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/43535#Comment_43535Thanks for the reply. This is what I wrote and see in the header, and in embedded data I set hidePrev to be 1, yet the back button is avaialble on all pages but the first.
image.pngI also tried to hide ALL buttons, and it works (as in, the NextButton is not visible in the first page):


Any ideas why it could be the case #PreviousButton not working? (also not working with #NextButton)

Userlevel 4
Badge +14

https://community.qualtrics.com/XMcommunity/discussion/comment/7990#Comment_7990Hi - appreciate this post is from 2018 - but would this still be the best way to do this. I'm finding that if a respondent fails the response validation on a page, then the back button reappears. Is there something else I need to do to stop that happening? Or am I best off using a different approach now?

Userlevel 7
Badge +27

MikeW ,
The basic process is still the same. When a respondent fails validation the page reloads. So, as stated above, it is a timing issue. Over time, Qualtrics has changed the behavior of button loading a number of times. The use of transition effects and in-page display logic also has an impact.
You could take the approach of using CSS to hide the back button by default, and then show it, but the same timing issues would still apply.

Userlevel 4
Badge +14

https://community.qualtrics.com/XMcommunity/discussion/comment/44063#Comment_44063Hi Tom - would the slow but safe method for me (based on my limited knowledge), be to put javascript on every question to individually hide the back buttons? I think that would work even when a page fails validation??

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/44064#Comment_44064I think you would still have the same issue.

Userlevel 4
Badge +14

https://community.qualtrics.com/XMcommunity/discussion/comment/44078#Comment_44078Thanks Tom

Userlevel 5
Badge +12

Hi TomG ,
Is there any JS to enable back button on the questions inspite having branch logics in the survey flow?

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/54556#Comment_54556No. I won't bother with the technical explanation of why.

Userlevel 5
Badge +12

I'm looking for a javascript custom code to solve the issue

Leave a Reply