Welcome to the LimeSurvey Community Forum

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

Moving automatically to next bquestion

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123167 by holch
Replied by holch on topic Moving automatically to next bquestion
While I can see why you want to implement that, my own experience and in usability tests is, that when there is no real change on the page, people don't understand what happened, especially when they are not very internet savvy. if the phrases are very similar, people might not notice that something has changed and click the answer given previously without reading.

So make sure that it is obvious to the user that something happened and something changed. A change of a page is pretty obvious a change to the user, here with the quick changes, people struggle sometimes. So some kind of animation (even if small, short and simple) would be good.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123170 by tpartner
Replied by tpartner on topic Moving automatically to next bquestion

So some kind of animation (even if small, short and simple) would be good.

Yep ;)

Code:
if(visibleQ.find('.radio:checked').length > 0) {
  answeredTotal++;
  var nextQ = visibleQ.next('.mandatory')
  visibleQ.fadeOut(400, function() {
    nextQ.fadeIn(400);
  });
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123174 by holch
Replied by holch on topic Moving automatically to next bquestion
Both scripts work fine in the default template. T-partners code is a nice addition.

Unfortunately doesn't work for my custom template... )-;

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 7 months ago #123177 by Bigred01
Replied by Bigred01 on topic Moving automatically to next bquestion
This should work unless the question element in question.pstpl has been put into a new container. next() will only find siblings.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123214 by holch
Replied by holch on topic Moving automatically to next bquestion
Thanks for the reply. This is probably it.

I probably have put a DIV around the question. Because I also have a line separating the questions and when questions are hidden due to conditions, this line still shows (this is a "bug" in my template that I was aware of, but never really went to fix it). It is probably time and this here is additional motivation, because this workaround here can be pretty useful.

But I wanted to use a different base for my template anyway, like the Skeletonquest theme from Dennis or the one from the Dutch guys. But I just didn't have time to look into this yet.

You can spend loads of time with creating templates... ;-)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 2 months ago #129694 by bruce78
Replied by bruce78 on topic Moving automatically to next bquestion
Thanks to everyone in this thread! The following works for me with Array (radio) and List (dropdown) questions but doesn't work for List (radio), which is fine. I've just pasted the code below into the template.js file for two versions of skeletonquest that I use.

Does anyone see any problems with the javascript below and should it keep on working with new versions of Limesurvey and different themes?
Code:
$(document).ready(function(){
    $(".list-dropdown select").change(function(){
    if($(this).val()!="" && $(this).val()!="-oth-"){
      $("#movenextbtn,#movesubmitbtn").delay(300).click();
    }
  });
    $('tr.radio-list input.radio').bind('click', function () {      
    var thisArray = $(this).closest('table');
    if($('input.radio:checked', thisArray).length == $('tr.radio-list', thisArray).length) {
      $("#movenextbtn,#movesubmitbtn").delay(300).click();
    }
  });
});
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #129695 by tpartner
Replied by tpartner on topic Moving automatically to next bquestion
It looks fine to me Bruce.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: bruce78
The topic has been locked.
More
8 years 2 months ago #129696 by bruce78
Replied by bruce78 on topic Moving automatically to next bquestion
Thanks Tony!
The topic has been locked.
More
7 years 11 months ago #134212 by first
Replied by first on topic Moving automatically to next bquestion
bruce78

I used your script and we need to add some more line of codes to handle array dual scale otherwise it will autosubmit without answering whole question.
Code:
function autoForward() {
    var timeOut = '';
    if($('.radio').length > 0 && $('.radio:checked').length === 0) {
    var totalQuestions = 0;
    var dualScaleQuestions = $('div.array-flexible-duel-scale:visible').length
    if(dualScaleQuestions > 0){
      totalQuestions = totalQuestions = $('div.list-radio:visible').length + ($('tr.radio-list:visible').length * 2);
    }else{
      totalQuestions = totalQuestions = $('div.list-radio:visible').length + $('tr.radio-list:visible').length;
    }
 
 
        $('.radio').on('change', function () {
            clearTimeout(timeOut);
            if ($('.radio:checked').length === totalQuestions && 
                !$(this).closest('.answer-item').hasClass('other-item') && 
                $('textarea:visible').length === 0 && 
                $('.checkbox:visible').length === 0) {
 
                timeOut = setTimeout(function () {              
                    $('#movenextbtn').click();
                }, 500);
 
            }
        });
    }
}

Survey Designer and Programmer
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose