Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Disable 'Next' with timer, open external link, run timer in background

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240008 by surveyLab24
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 2.67.3+170728
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hello,

I have disabled the 'Next' button on a question using a timer. I would like to have the survey participant click on a link within the question (the same one that has the timer and disabled 'Next' button) which would then open the external link in the same tab. After completing an experiment in the external URL, the user would be redirected back to LimeSurvey at the same question they left off at. 

The issue I am having is that the timer seems to pause once the user leaves LimeSurvey and any elapsed time since leaving the site and coming back is not taken into account. If I leave LimeSurvey at the timed question which states 25 seconds left, even if I leave the site for 1 minute and come back, the question will resume the timer from 25 seconds. 

Is there a way to have the timer run continuously once it starts even when the user leaves LimeSurvey? I am not able to use JavaScript due to the limitations of my LimeSurvey account. 

Any help would be appreciated and thanks so much for your support. 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #240036 by Joffm
Hi,
as you run a nearly six years old version of LimeSurvey, which is based on a different framework than the recent versions, you should provoide a lss export of your survey (only these relevant questions)

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240039 by surveyLab24
Hi Joffm,

Thanks so much for your reply. I have attached an lss export of the survey. It has 3 questions, and the timed question is the second one with the 'Start' button.

Just to provide some background info. The main thing I was trying to accomplish was disabling the 'Next' button until the user clicks on the 'Start' button within the question which will forward them to an external URL to complete an experiment. After the first experiment, the user is redirected to a second website to perform another experiment. From the second experiment, the user is directed back to LimeSurvey and at this point the 'Next' button should be enabled to allow them to proceed. 

I've currently only found disabling 'Next' with a timer to work for this case. If you had a different idea of accomplishing this, I would be happy to hear your thoughts. I've added an overview below of the path. 

Timed question ('Next' Disabled) ----> User clicks 'Start' on the question ----> User is redirected to external website to complete experiment ----> User is redirected to second external website ----> User is redirected back to same LimeSurvey question ('Next' button should be enabled here)

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240041 by surveyLab24
I seem to be having an issue with attaching the .lss file. I get the message "Failed to create attachment directory"

Is there an alternative way I could send the .lss file to you perhaps by email or another means?

 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago - 1 year 9 months ago #240044 by Joffm
There seems to be some issue with the forum at the moment.
I also can't attach anything.

Message:
Could not move file into /var/www/clients/client1/web137/web/media/kunena/attachments/48983/92518f46ec7b9d78a3e2c9570c4b0f2b. 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 9 months ago by Joffm.

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240050 by surveyLab24
Perhaps I could upload the file onto my OneDrive account and share a link with you to download the .iss file.

Would that be okay?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #240053 by Joffm
Yes, that should work 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240054 by surveyLab24
Alright.

Here is the OneDrive link:  limesurvey_survey_168962.lss

It should allow you to download the file. Let me know if you run into any issues.

Thanks

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #240062 by Joffm
Hi,
you confused me a bit.
You do not open the experiment in the same tab, but in a different (target="_blank")
I thought you really open it in the same tab (target="_self") and was wondering how you return to this page afterwards.

And what for do you use the timer? Only to hide the "Next"-Button for 30 seconds?
And why do you want the button to appear after 30 seconds?

In my opinion the button is hidden (for some reasons) and the respondent clicks to start the experiment.
And after the experiment it is not necessary to return to this same page, only to click "Next" to proceed to the next page.

Therefore I suggest
1. remove everything related to the timer
2. hide the "Next" button initially
Code:
<style type="text/css">
#ls-button-submit {
  display:none;
}
</style>

3. while the respondent is doing the experiment LimeSurvey proceeds to the next page after 30 seconds
javascript
Code:
<script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
            setTimeout(function () {
               $('#ls-button-submit').trigger('click').show();
          }, 30000);  // Proceed after 30 seconds
    });
</script>
 

Joffm

P.S.
You have to check with your webdevelopment tool, what is the ID of the button in your 2.50/2.73 version.
I think it is  #movenextbtn
So replace #ls-button-submit 
But please check.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240065 by surveyLab24
Thanks for your reply. 

Currently, the experiment opens in a different tab, but I would like for it to open in the same tab that the LimeSurvey question is present in. So ideally, the experiment would open in same tab, then the user finishes that experiment and is directed to the second experiment in the same tab. After that, the user is directed back to LimeSurvey where they left off in the same tab but now with the 'Next' button enabled. Because the user has completed both experiments, the 'Next' button would be enabled allowing them to proceed further into the survey. 

I set the timer to 30 seconds for testing but for real-life use it would be more around 10 minutes long. The reason for disabling the 'Next' button was to prevent the user from proceeding further into the survey without starting and completing the experiment first. The initial idea was to use the timer and have it run for the same time as it would take both experiments to finish which currently might be 10 minutes. This is probably not the best solution I think. 

The sample survey I provided only links to one experiment but as long as there is a way get back from a webpage to where we left off in LimeSurvey with the 'Next' button enabled that would solve the issue.

I'm not sure where to add javascript into this question or hiding the next button. There might be some limitations on my LimeSurvey account since access was provided to me from my professors. 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #240079 by tpartner
The only way to return to the survey within the same tab is to use tokens and response persistence. However, in this case, you would be returned to the last submitted page.

I would look into using two surveys or putting the remote site in an iframe.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • surveyLab24
  • surveyLab24's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #240104 by surveyLab24
Hi Tony, 

Thanks for the suggestions. I tried activating the surveys in closed-access mode in order to use tokens for dummy participants, left LimeSurvey while the timer was running and came back. Unfortunately the timer still paused after leaving the site and resumed only when coming back to LimeSurvey (any elapsed time from leaving the site was not taken into account). I also had token-based response persistence set to on.

I tried adding the external site as an iframe into the question but when I add the code, it is automatically removed when I save the question. The same occurs if I try to enter any javascript. 

I did suggest using two surveys to my professors but they mentioned that they would prefer to not have two surveys. 

 

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose