Welcome to the LimeSurvey Community Forum

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

10 point scale question

  • Samy34
  • Samy34's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #179517 by Samy34
10 point scale question was created by Samy34
Hello everyone,

One of my clients would like a questionnaire with questions that use 10-point scales and two choices for not answering. Is it possible to display "Satisfied" and "Dissatisfied" as in the attached image?


I programmed the example in the attached image using a double-scale questions. With a double-scale question, is there a Javascrip or JQuerry that would allow the respondent to provide an answer to only one of the scales? To make the questionnaire mandatory, I would like to use a popup that would appear if the person clicks next and one of the sub questions has no answers.

I think part of the code on this post could do exactly what I want. However, I lack knowledge to adapt to the new version of Limesurvey. www.limesurvey.org/forum/can-i-do-this-w...dual-scale-questions

I am using Limesurvey version 3.15.5.

Thanks in advance,
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179523 by tpartner
Replied by tpartner on topic 10 point scale question
Can you attach a small sample survey containing only that question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Samy34
  • Samy34's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #179528 by Samy34
Replied by Samy34 on topic 10 point scale question
Hello tpartner,

Here is a small questionnaire in iss format. Is it ok that way?

To put the elements "Dissatisfied" and "Satisfied", I used 2 <span> in the header of the first scale.

Thank you in advance for your help :)

File Attachment:

File Name: Scale_10_points.lss
File Size:23 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago - 5 years 2 months ago #179544 by tpartner
Replied by tpartner on topic 10 point scale question
Disable AJAX in the theme options and add this script to the question source. It will enforce the clicking of a single radio in each row and pop up an alert if rows are unanswered on submit.

Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Listener on the radios
    $('input:radio', thisQuestion).on('click', function(e) {
      // Identify some elements/vars
      var thisRow = $(this).closest('tr.answers-list');
      var thisInput = $(this);
      var thisName = thisInput.attr('name');
      var otherInput = $('input:radio', thisRow).not('[name="'+thisName+'"]').first();
 
      // Uncheck other radios in this row
      $('input:radio', thisRow).not(thisInput).prop('checked', false);
 
      // Fire expression manager on the unchecked radios
      var otherName = otherInput.attr('name').replace('#', '_');
      $('#java'+otherName).val('');
      ExprMgr_process_relevance_and_tailoring('change', otherName, 'radio');
 
      // Check for answered rows
      if($('input:radio:checked', thisQuestion).length == $('tr.answers-list', thisQuestion).length) {
        $(thisQuestion).removeClass('input-error');
      }
    });
 
    // Interrupt the submit and check for answered rows
    $('#ls-button-submit').on('click', function(e) {
      if($('input:radio:checked', thisQuestion).length != $('tr.answers-list', thisQuestion).length) {
        $(thisQuestion).addClass('input-error');
        alert('Please answer all rows.');
        e.preventDefault();
        return false;
      }
    });  
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...3831.lss
File Size:24 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 2 months ago by tpartner.
The following user(s) said Thank You: Samy34
The topic has been locked.
  • Samy34
  • Samy34's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #179563 by Samy34
Replied by Samy34 on topic 10 point scale question
Wow Thank you so much !! It works perfectly
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose