Idiot Detector

More
4 years 4 months ago #89775 by helper
helper created the topic: Idiot Detector
I thought that I had seen most everything... whoa, wrong assumption.

The request that I received includes validating a question and/or group (depending on how the admin settings are setup) at submit (or next). If the user did not answer the question(s) then they should get a javascript confirm - if the user selects cancel then it will return false back to the question(s) otherwise the submit goes through. The use case they gave is a validation message to either skip the question (confirm) or return to the question (return false).

Seems to be another usability idiot detector to me...

Has anybody else ran into this type of requirement and how did you resolve?

Please Log in to join the conversation.

More
4 years 4 months ago #89781 by tpartner
tpartner replied the topic: Idiot Detector
It's easy to interrupt the submit with a confirm message but the code that triggers it (if questions are unanswered) would depend on the question types on the page.

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.

More
4 years 4 months ago #89891 by helper
helper replied the topic: Idiot Detector
Is the global $notanswered boolean common to all questions and would that be a better catch/trigger?

Please Log in to join the conversation.

More
4 years 4 months ago #89935 by tpartner
tpartner replied the topic: Idiot Detector
I don't know if it's common but regardless, it's server-side which would require modifying the core code.

After a little thought it gets a little messy anyway.You would need to put in something to prevent repeat confirms if the respondent goes back and modifies/answers a question. And if it were me taking the survey, I would get real cranky after a few pages with the confirms. Most surveys are onerous enough without extra clicks.

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.

More
3 years 10 months ago #96572 by cmrodgers
cmrodgers replied the topic: Idiot Detector
I am having this same issue. Did you ever figure out a resolution?

I was thinking that the script will have to be customized based on question type but I don't even know where to start!

Please Log in to join the conversation.

More
3 years 10 months ago - 3 years 10 months ago #96574 by tpartner
tpartner replied the topic: Idiot Detector
Here is a post about applying "unanswered" and "answered" classes to questions.

You could then interrupt the "Next" function, look for unanswered questions and pop up a confirm message:

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function(){
 
		// Interrupt the Next/Submit function
		$('form#limesurvey').submit(function(){
 
			// Override the built-in "disable navigation buttons" feature
			$('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', '');
 
			// Oops, found some unanswered questions...
			if ($('.unanswered').length > 0) {
				if(confirm('You have not answered all of the questions. Do you want to continue?')) { 
					return true;
				}
				else { 
					return false;
				}
			}
		});
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 10 months ago by tpartner.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now