- Posts: 153
- Thank you received: 5
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Capture/Display Time Remaining for Timed Questions
- dweisser
- Topic Author
- Offline
- Premium Member
Less
More
10 years 2 months ago #102940
by dweisser
Capture/Display Time Remaining for Timed Questions was created by dweisser
Hi all,
Would anyone have an idea how I could capture the time remaining on a timer for Question 1 and display that value in Questions 2. Question 2 is on a separate page as part of a "report".
Any thoughts, as always, are most appreciated.
David
Would anyone have an idea how I could capture the time remaining on a timer for Question 1 and display that value in Questions 2. Question 2 is on a separate page as part of a "report".
Any thoughts, as always, are most appreciated.
David
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #102946
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Capture/Display Time Remaining for Timed Questions
I would place a short-text question in the same group (on the same page) directly after the timed question. JavaScript could be used to hide the short-text and load it with the timer text when the page is submitted. You could then use Expression Manager to pipe the value of the hidden question into your report.
1) Add a short-text question in the same group (on the same page) directly after the timed question.
2) Add this script to the source of the timed question:
.
1) Add a short-text question in the same group (on the same page) directly after the timed question.
2) Add this script to the source of the timed question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify the questions var qID = {QID}; var thisQuestion = $('#question'+qID); var nextQuestion = $(thisQuestion).nextAll('.text-short:eq(0)'); // Hide the next question $(nextQuestion).hide(); // Interrupt the Next/Submit function $('form#limesurvey').submit(function(){ // Override the built-in "disable navigation buttons" feature $('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', ''); // Store the time remaining $('input[type="text"]', nextQuestion).val($('#LS_question'+qID+'_Timer').text().replace(/Time remaining/, '')); return true; }); }); </script>
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- dweisser
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 5
10 years 2 months ago #102963
by dweisser
Replied by dweisser on topic Capture/Display Time Remaining for Timed Questions
Thank you TPartner.
I'll give this a shot...but when I set the timer on a question, it's like I can't proceed to the next page (survey is group by group) until the timer is expired. Is there a setting or something that I'm missing?
I'll give this a shot...but when I set the timer on a question, it's like I can't proceed to the next page (survey is group by group) until the timer is expired. Is there a setting or something that I'm missing?
The topic has been locked.
- dweisser
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 5
10 years 2 months ago - 10 years 2 months ago #102965
by dweisser
Replied by dweisser on topic Capture/Display Time Remaining for Timed Questions
Yes, I was missing a setting. But what's weird is that I was misremembering...I can move previous even though the question settings are set to prevent it.
I am using images instead of standard buttons, but like I said, the Advanced settings seem to work fine with respect too the next button.
Perhaps the button id should be renamed?
<img id="alt-prevbtn" class="alt-prevbtn" src=" www.springboltconsulting.com/surveyasset...ev_custom2_hover.png ">
Hmm. I'll keep fiddling with it. Has anyone else had a similar issue?
Nebraska David
I am using images instead of standard buttons, but like I said, the Advanced settings seem to work fine with respect too the next button.
Perhaps the button id should be renamed?
<img id="alt-prevbtn" class="alt-prevbtn" src=" www.springboltconsulting.com/surveyasset...ev_custom2_hover.png ">
Hmm. I'll keep fiddling with it. Has anyone else had a similar issue?
Nebraska David
Last edit: 10 years 2 months ago by dweisser.
The topic has been locked.
- dweisser
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 5
10 years 2 months ago - 10 years 2 months ago #102972
by dweisser
Replied by dweisser on topic Capture/Display Time Remaining for Timed Questions
Capturing the timer is awesome. Works splendidly. The Buttons don;t seem to respond to the disable command. Maybe it's template specific. I'l update the Forum you if I find out.
Happy new Year TPartner!
Happy new Year TPartner!
Last edit: 10 years 2 months ago by dweisser.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #102974
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Capture/Display Time Remaining for Timed Questions
And a happy New Year from Ottawa, Canada to you David and and all of our users too.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.