Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Idiot Detector

Idiot Detector 4 years 3 days ago #89775

  • helper
  • helper's Avatar
  • Offline
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
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?
The administrator has disabled public write access.

Idiot Detector 4 years 3 days ago #89781

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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.
The administrator has disabled public write access.

Idiot Detector 4 years 11 hours ago #89891

  • helper
  • helper's Avatar
  • Offline
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
Is the global $notanswered boolean common to all questions and would that be a better catch/trigger?
The administrator has disabled public write access.

Idiot Detector 4 years 2 hours ago #89935

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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.
The administrator has disabled public write access.

Idiot Detector 3 years 6 months ago #96572

  • cmrodgers
  • cmrodgers's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
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!
The administrator has disabled public write access.

Idiot Detector 3 years 6 months ago #96574

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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 6 months ago by tpartner.
The administrator has disabled public write access.
Time to create page: 0.322 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form