Automatically proceed to next question (without clicking "next")

Plus d'informations
il y a 4 ans 5 mois #95995 par ahavlik
ahavlik a créé le sujet : Automatically proceed to next question (without clicking "next")
Hi,
I'm trying to allow my participants to to automatically move to the next question after clicking yes/no so that I may record their proper response times. I've tried to figure this out using javascript however, I don't have administrator capabilities as its through my university's website so not sure how to embed java. If anyone knows what to do/has a fix, please let me know. Thanks for your time to anyone reading this.

Connexion pour participer à la conversation.

Plus d'informations
il y a 4 ans 5 mois #96016 par tpartner
tpartner a répondu au sujet : Automatically proceed to next question (without clicking "next")
If using a yes/no radio question, set up your survey to use JavaScript and add the following script to the source of the question.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		$('#question{QID} input.radio'),click(function() {
			if($('#movesubmitbtn').length > 0) {
				document.limesurvey.move.value = 'movesubmit';
			}
			else {
				document.limesurvey.move.value = 'movenext';
			}
			document.limesurvey.submit();
		});
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Les utilisateur(s) suivant ont remercié: ahavlik

Connexion pour participer à la conversation.

Plus d'informations
il y a 4 ans 5 mois #96028 par ahavlik
ahavlik a répondu au sujet : Automatically proceed to next question (without clicking "next")
Thanks for this!

The issue I'm having now is trying to get the admin at my university to change the global settings to allow javascript to run (which they won't do). Can you think of any non-java workarounds I might try to use? Anyway, thanks for your time.

Sincerely,
Andrew

Connexion pour participer à la conversation.

Plus d'informations
il y a 4 ans 5 mois #96033 par tpartner
tpartner a répondu au sujet : Automatically proceed to next question (without clicking "next")
Unfortunately, I don't know of any non-JavaScript solutions.

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

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 8 mois #105223 par dweisser
dweisser a répondu au sujet : Automatically proceed to next question (without clicking "next")
Perhaps related to this...Is there a way to auto_submit a survey?

I would like to automatically submit the survey before a session timed out if the respondent "walked away" from a live survey.

Is it possible?

David

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 8 mois #105239 par byan
byan a répondu au sujet : Automatically proceed to next question (without clicking "next")
Again, you will have to use javascript.

function doSubmit() {
document.limesurvey.move2.click();
}

setTimeout("doSubmit()", #000);

# sets the number of seconds for auto submission

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 8 mois #105253 par DenisChenu
DenisChenu a répondu au sujet : Automatically proceed to next question (without clicking "next")
HI,

Think with 2.05, it's more easy to use :
$("#defaultbtn").click();
Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 8 mois #105273 par emimarz
emimarz a répondu au sujet : Automatically proceed to next question (without clicking "next")
do no exist a non-javascript solution

I tell you why

Do click is an event that occurs on the client side on the client PC

Javascript is a client-side scripting language

He is the only one that can interact with the user because HTML is too poor

:woohoo: :woohoo: :woohoo:
too much coffee

Best
Emiliano

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 7 mois #106387 par dweisser
dweisser a répondu au sujet : Automatically proceed to next question (without clicking "next")
To follow up on this,

How would you program this to occur on every page of the survey?

So, if on page 3, the respondent walked away from the survey, how would you submit after 5 minutes time?
What about page 4? and so on?

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 7 mois - il y a 3 ans 7 mois #106389 par tpartner
tpartner a répondu au sujet : Automatically proceed to next question (without clicking "next")
Well, auto-submitting the survey may be a little problematic because unanswered mandatory questions would prevent it and even if the submit worked it would only lead to the next survey page.

I think a better approach may be to pop up a warning after some period of inactivity and then redirect to somewhere like the root of the survey installation (the survey list page).

I'll need to give some thought to how to determine "inactivity", or more to the point, "activity" with all question types.


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Dernière édition: il y a 3 ans 7 mois par tpartner.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 7 mois #106399 par dweisser
dweisser a répondu au sujet : Automatically proceed to next question (without clicking "next")
I hear what you're saying...
The goal I have is to collect as much data as possible, so I'm not sure redirection is the answer.
Any advice you have to offer is always much appreciated.
David

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 7 mois - il y a 3 ans 7 mois #106406 par tpartner
tpartner a répondu au sujet : Automatically proceed to next question (without clicking "next")
I can't agree with forcing the browser to submit the form. I my opinion, any form submission should be left entirely up to the user.

However, if you just want to remove the survey from an inactive computer you can add something like this to the end of template.js.

(adjust the first 5 variable as necessary)

This will:
- Start an "alert" timer on page load
- When the "alert" timer expires a dialog is popped up and a "redirect" timer is started
- When the "redirect" timer expires the page is redirected
- Closing the dialog will stop the "redirect" timer and restart the "alert" timer
- Any activity in the form (click, key-up, paste, change) will restart the "alert" timer

$(document).ready(function(){
 
	var txtAlertMessage = 'Anyone there? Do you want to continue?';		
	var txtCloseButton = 'Continue';
	var redirectURL = location.pathname.split('index.php')[0];
	var timeToAlert = 300; // In seconds
	var timeToRedirect = 5; // In seconds
 
	// Page timeout action
	function pageTimeout() {
		window.location = redirectURL;
	}	
 
	// Alert Timer
	var alertTimer;
	function startAlertTimer() {
		alertTimer = setTimeout(function() {
			$('.custom-dialog-1').dialog('open');
		},timeToAlert*1000);
	}		
	function stopAlertTimer() {
		clearTimeout(alertTimer);
	}		
	function restartAlertTimer() {
		clearTimeout(alertTimer);
		startAlertTimer();
	}
	startAlertTimer();
 
	// Redirect Timer
	var redirectTimer;
	function startRedirectTimer() {
		redirectTimer = setTimeout(function() {
			pageTimeout();
		},timeToRedirect*1000);
	}		
	function stopRedirectTimer() {
		clearTimeout(redirectTimer);
	}		
	function restartRedirectTimer() {
		clearTimeout(redirectTimer);
		startRedirectTimer();
	}	
 
	// Insert the alert dialog
	var timeoutDialog = '<div class="custom-dialog-1"> \
							<div class="text">'+txtAlertMessage+'</div> \
							<div class="buttons"> \
								<button class="close" type="button" value="close">'+txtCloseButton+'</button> \
							</div> \
						</div>';
	$(timeoutDialog).dialog({
		autoOpen: false,
		open: function( event, ui ) {
			startRedirectTimer();
			//IE 10 z-index hack
			$('.ui-widget-overlay').css('z-index', Number($('.ui-widget-overlay').css('z-index')) - 2);
		},
		close: function( event, ui ) {
			stopRedirectTimer();
			restartAlertTimer();
		},
		width: 400,
		modal: true,
		resizable: false,
		draggable: false,
		closeOnEscape: true,
		dialogClass: 'timeout-dialog'
	});
	$('.timeout-dialog button').click(function() {
		$('.custom-dialog-1').dialog('close');
	});
 
	// Listener for activity
	$('#limesurvey').on('click keyup paste change' ,function(event){ 
		restartAlertTimer();
	});
});

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Dernière édition: il y a 3 ans 7 mois par tpartner.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 6 mois #107123 par dweisser
dweisser a répondu au sujet : Automatically proceed to next question (without clicking "next")
For the record,
I'm not auto-submitting surveys. In the end, no body wants that. However, I was working with the code and trying to figure out why this wont work:
// Page timeout action
	function pageTimeout() {
		//window.location = redirectURL;
 
// Find the group index 
    var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
 
        if(groupIndex[0] >= 0) {
        $('#movesubmitbtn').click();
        }    
        else {
        window.location = redirectURL;
        }
    }

There seems to be something wrong with this:
$('#movesubmitbtn').click();
, but I can't figure out what it is. If I simple put this:
$('#movesubmitbtn').click();
in the timer block without a condition - it auto submits. What gives?

Any thoughts would be appreciated.
David

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 6 mois #107124 par tpartner
tpartner a répondu au sujet : Automatically proceed to next question (without clicking "next")
Hard to say without seeing all of the code but it seems to me that groupIndex is an array item, not an array.

So, this:
if(groupIndex[0] >= 0) {

Should be this:
if(groupIndex >= 0) {

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

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 6 mois - il y a 3 ans 6 mois #107144 par dweisser
dweisser a répondu au sujet : Automatically proceed to next question (without clicking "next")
I had tried that, T. And everything else. HEre is the whole code block.
It just won't work inside the condition - and its making me crazy!
$(document).ready(function(){
 
    var txtAlertMessage = 'Anyone there? Do you want to continue?';		
	var txtCloseButton = 'Continue';
	var redirectURL = location.pathname.split('index.php')[0];
	var timeToAlert = 2; // In seconds
	var timeToRedirect = 2; // In seconds
 
	// Page timeout action
	function pageTimeout() {
// Find the group index - 
    var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
 
        if(groupIndex >= 0) {
        $('#movesubmitbtn').click();
        }    
        else {
        window.location = redirectURL;
        }
    }	
 
 
 
	// Alert Timer
	var alertTimer;
	function startAlertTimer() {
		alertTimer = setTimeout(function() {
			$('.custom-dialog-1').dialog('open');
		},timeToAlert*1000);
	}		
	function stopAlertTimer() {
		clearTimeout(alertTimer);
	}		
	function restartAlertTimer() {
		clearTimeout(alertTimer);
		startAlertTimer();
	}
	startAlertTimer();
 
	// Redirect Timer
	var redirectTimer;
	function startRedirectTimer() {
		redirectTimer = setTimeout(function() {
			pageTimeout();
		},timeToRedirect*1000);
	}		
	function stopRedirectTimer() {
		clearTimeout(redirectTimer);
	}		
	function restartRedirectTimer() {
		clearTimeout(redirectTimer);
		startRedirectTimer();
	}	
 
	// Insert the alert dialog
var timeoutDialog = '<div class="custom-dialog-1">							<div class="text">'+txtAlertMessage+'</div>
<div class="buttons">
<button class="close" type="button" value="close">'+txtCloseButton+'</button> 							</div>
</div>';
	$(timeoutDialog).dialog({
		autoOpen: false,
		open: function( event, ui ) {
			startRedirectTimer();
			//IE 10 z-index hack
			$('.ui-widget-overlay').css('z-index', Number($('.ui-widget-overlay').css('z-index')) - 2);
		},
		close: function( event, ui ) {
			stopRedirectTimer();
			restartAlertTimer();
		},
		width: 400,
		modal: true,
		resizable: false,
		draggable: true,
		closeOnEscape: true,
		dialogClass: 'timeout-dialog'
	});
	$('.timeout-dialog button').click(function() {
		$('.custom-dialog-1').dialog('close');
	});
 
	// Listener for activity
	$('#limesurvey').on('click keyup paste change' ,function(event){ 
		restartAlertTimer();
	});
});
Dernière édition: il y a 3 ans 6 mois par dweisser.

Connexion pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant