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

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

  • Dec 29, 2020 9:12 PM UTC
  • 9 replies
  • 365 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 ●●●●●
  • Dec 30, 2020 9:52 AM UTC

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


  • Author
  • Dec 30, 2020 1:32 PM UTC

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 ●●●●●●●●
  • Answer
  • Dec 30, 2020 4:00 PM UTC

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
  • Dec 30, 2020 4:24 PM UTC

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


  • Mar 7, 2021 2:18 AM UTC

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 ●●●●●●●●
  • Mar 7, 2021 1:41 PM UTC

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.


  • Mar 7, 2021 6:43 PM UTC

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 ●●●●●●●●
  • Mar 9, 2021 1:39 PM UTC

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
  • Oct 25, 2023 11:05 AM UTC

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?