Welcome to the LimeSurvey Community Forum

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

Problem with mandatory sliders and hidden handles

  • HellaHepp
  • HellaHepp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #120939 by HellaHepp
Hi!

I wanted to include sliders in my survey with hidden handle by default until user clicks on the slider.

Thanks to Tony's solution found here ( www.limesurvey.org/de/forum/can-i-do-thi...ser-clicks-on-slider ) I was able to do so.

Playing with that approach I found a significant drawback which I would love to solve:

1. Just imagine you have a question containing 20 mandatory sliders.
2. A participant answers 19 sliders but accidentally misses a single one.
3. After clicking "Next" the mandatory error message appears (with the page reloaded).
4. Now all sliders are hidden again (even the sliders already answered), so the participant thinks s(he) has to answer all sliders again (which is not the case as the values have been stored).


Any ideas how to circumvent that behaviour, e. g. by
- showing the handles of the sliders already answered or
- hiding those answered sliders completely or
- deactivating the "next"-button until ALL sliders have been answered or
- ...?


Thanks in advance!
Hella
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #120955 by tpartner
Try this:
Code:
  $(document).ready(function() { 
 
    // Initial slider handle states
    $('.ui-slider').each(function(i){
      var thisItem = $(this).closest('.answer-item');
      if($('input.text', thisItem).val() == '') {
        $('.ui-slider-handle', thisItem).hide();
      }
    });
 
    // Listener on the sliders
    $('.ui-slider').mousedown(function(){
      $('.ui-slider-handle', this).show();
    });
  });

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: HellaHepp
The topic has been locked.
  • HellaHepp
  • HellaHepp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #120960 by HellaHepp
Hi Tony!

I tried your code and... (*drum roll*)... it works! :woohoo:

Thank you so much!

Best regards
Hella
The topic has been locked.
More
8 years 7 months ago #123354 by jelo
Is there a working link to the original thread. The search function didn't brought up a hit.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123359 by holch

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.

Lime-years ahead

Online-surveys for every purse and purpose