Welcome, Guest
Username: Password: Remember me

TOPIC: add 'are you sure' to 'no answer' as default in radio list

add 'are you sure' to 'no answer' as default in radio list 7 months 2 weeks ago #107416

  • pietpomp
  • pietpomp's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Thank you received: 3
  • Karma: 0
Hi Guys, I have a Q-group of a few questions that are not mandatory and so displays 'no-answer' as the default answer in a radio list (survey is set to display by group v2.05+).

This allows user to skip the page 'by accident' without reading the questions.

I would like to add a check on the page (group) that (for example pops up) would check to see if any q's are still on 'no answer' and then ask the user "Are you sure you don't want to answer?". Yes -> survey goes on with next group(like Next button), No -> survey stays on page.

Had a look at conditions, but not sure how to get it to stay on the same group after the check...

Thanks

-apologies, my previous duplicate #107414 was in the wrong forum section.
The administrator has disabled public write access.

add 'are you sure' to 'no answer' as default in radio list 7 months 2 weeks ago #107420

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6560
  • Thank you received: 871
  • Karma: 257
With EM and without change:1st question code MULTIQ

Solution 1
Add a second question, CONFIRM : multiple with only one answer 'Are you sure you don't want to answer' and set it mandatory.
Second question condition sum(is_empty(that.QQ))>0

Solution 2
Add 'No answer' answer and set MULTIQ mandatory. User have to click on 'No Answer' answre.

Solution 3
jquery/javascripting : Add an event on submit $("#limesurvey").submit(.... and call a confirm box here.

Denis
The administrator has disabled public write access.
The following user(s) said Thank You: pietpomp

add 'are you sure' to 'no answer' as default in radio list 7 months 2 weeks ago #107424

  • pietpomp
  • pietpomp's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Thank you received: 3
  • Karma: 0
thx Denis,
I've got a group by group presentation and I want the confirmation to pop up on one group (page1) with say 4 questions before they get to the next group (page2).

So I don't understand how Solution 1 will be added or how it could work, cause manual said condition only work for the next page of questions.

Solution 2 sounds good, but will make them 1. have to enter and value and 2. keep popping up for each q in the group instead of once for the page.

Solution 3 looks the most promising. That way I could maybe also have a custom message. Unfortunately I'm useless with js. But it looks like you are suggesting to intercept the next button with the check. That would be perfect as long as the user continues after one pop up per page and not a pop up for each question on the page. So I guess the js would need to check if there are any 'no answer' values present on the page and then do the pop up.

Would you be able to help with the js please?
cheers
The administrator has disabled public write access.

add 'are you sure' to 'no answer' as default in radio list 7 months 2 weeks ago #107429

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 829
  • Karma: 381
Denis' solution 3...

Set up your survey to use JavaScript

If you want to pop up the confirm message every time the "Next" button is clicked and some "No Answer" radios are checked, add this to the question source of any question on the page:
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() { 
 
		// Interrupt the submit process
		$('#movenextbtn, #movesubmitbtn').bind('click', function () {
			if($('input.radio[value=""]:checked').length > 0) {
				var moveOn = confirm("Some questions remain unanswered. \nDo you want to continue?");
				if (moveOn == false) {
					return false;
				}
			}
		});
 
	});
</script>

If you only want it to happen the first time the "Next" button is clicked, add this to the question source of any question on the page:
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() { 
 
		var confirmShown = 0;
 
		// Interrupt the submit process
		$('#movenextbtn, #movesubmitbtn').bind('click', function () {
			if($('input.radio[value=""]:checked').length > 0 && confirmShown == 0) {
				confirmShown = 1;
				var moveOn = confirm("Some questions remain unanswered. \nDo you want to continue?");
				if (moveOn == false) {
					return false;
				}
			}
		});
 
	});
</script>


.
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 7 months 2 weeks ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: pietpomp

add 'are you sure' to 'no answer' as default in radio list 7 months 2 weeks ago #107454

  • pietpomp
  • pietpomp's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Thank you received: 3
  • Karma: 0
Legend!
Thank you guys and tpartner thanks so much for the two versions. It's clear you can see what the next question could have been and giving a working script for that to.

I was going to ask about the custom button text, but google covered that one hehe.

Can smell the end now, just need to get this glitch sorted.
Cheers
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image