Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

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

  • pietpomp
  • pietpomp's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 11 months ago #107416 by pietpomp
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 topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #107420 by DenisChenu
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

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: pietpomp
The topic has been locked.
  • pietpomp
  • pietpomp's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 11 months ago #107424 by pietpomp
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 topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago - 9 years 11 months ago #107429 by tpartner
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:
Code:
<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:
Code:
<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 &amp;&amp; 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.
Last edit: 9 years 11 months ago by tpartner.
The following user(s) said Thank You: pietpomp
The topic has been locked.
  • pietpomp
  • pietpomp's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 11 months ago #107454 by pietpomp
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 topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose