Can I force a user to download a document that's a hyperlink in a survey question? | XM Community
Skip to main content
Solved

Can I force a user to download a document that's a hyperlink in a survey question?

  • December 29, 2020
  • 9 replies
  • 242 views

I'm trying to force a user to download a document before they can continue in a survey. I've set a mandatory yes/no question "I certify I have read and understand the contents of the document", but I want to be able to force the user to download the document, even if they answer "yes" to the question. I've set this parameter, but it doesn't seem to have an effect - I can still move past the question by answering "Yes", and nothing else has changed.

Force download.jpg

Best answer by TomG

You could use JavaScript to disable the Next button, then enable it once the respondent clicks the link to download the file. It would be something like:
HTML:
Download file
JS:
var qobj = this;
qobj.disableNextButton();
jQuery("#fileLink").click(function() { qobj.enableNextButton(); });

View original

9 replies

MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Level 5 ●●●●●
  • 456 replies
  • December 30, 2020

Just my 5 cents, for security reasons i would never proceed with a survey that forces me to download something...


  • Author
  • 2 replies
  • December 30, 2020

True that, and understood. Context of this survey is a bit different - it would be a considerations for sure, but potentially manageable.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5935 replies
  • Answer
  • December 30, 2020

You could use JavaScript to disable the Next button, then enable it once the respondent clicks the link to download the file. It would be something like:
HTML:
Download file
JS:
var qobj = this;
qobj.disableNextButton();
jQuery("#fileLink").click(function() { qobj.enableNextButton(); });


  • Author
  • 2 replies
  • December 30, 2020

Thank you, Tom. figured it would be something along those lines. Appreciate the code examples!


  • 2 replies
  • March 7, 2021

https://www.qualtrics.com/community/discussion/comment/32977#Comment_32977How could I extend this to force a respondent to download two files before progressing?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5935 replies
  • March 7, 2021

https://www.qualtrics.com/community/discussion/comment/35352#Comment_35352Yes, use a count variable to keep track of how many files have been downloaded then enable the next button when the count reaches two. Instead of using an id use a class assigned to both files.


  • 2 replies
  • March 7, 2021

https://www.qualtrics.com/community/discussion/comment/35355#Comment_35355Sorry, JS novice here. The count idea makes sense but unsure about implementation.
Suppose I have these two links to be downloaded:
Download file 1
Download file 2
What would be the JS code to only show the forward arrow once both files have been downloaded?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5935 replies
  • March 9, 2021

nelly86 ,
On second thought, you need to make sure each file is downloaded instead the same file being downloaded twice. Change code to:
var qobj = this;
qobj.disableNextButton();
var link1 = false, link2 = false;
jQuery("#fileLink1").click(function() {
link1 = true;
if(link1 && link2) qobj.enableNextButton();
});
jQuery("#fileLink2").click(function() {
link2 = true;
if(link1 && link2) qobj.enableNextButton();
});


Forum|alt.badge.img
  • 1 reply
  • October 25, 2023
TomG wrote:

nelly86 ,
On second thought, you need to make sure each file is downloaded instead the same file being downloaded twice. Change code to:
var qobj = this;
qobj.disableNextButton();
var link1 = false, link2 = false;
jQuery("#fileLink1").click(function() {
link1 = true;
if(link1 && link2) qobj.enableNextButton();
});
jQuery("#fileLink2").click(function() {
link2 = true;
if(link1 && link2) qobj.enableNextButton();
});
 

Hi TomG 

The java code did not work for me. Same situation as Nelly, but the next button remains disabled after the documents are downloaded. Any suggestions?


Leave a Reply