Welcome to the LimeSurvey Community Forum

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

Display number of rows in array question based on previous numerical input

More
8 years 9 months ago #121765 by Remundo
Hello,
Have you found a solution to this problem?

ricardo wrote: Hi Tony,

There small glitch in this workaround

The rows don't display as soon as the number is entered...they only show up after clicking somewhere else...is there a way to make the rows appear as soon as the number is entered.




this is a link to the question broaderimpacts.org/surveys/limesurvey/index.php/289571/lang-en

rg


Rémi B.
Technicien en production, traitement, analyse de données et enquêtes
Observatoire de la réussite et de la vie étudiante (OREVE)
15, Rue de l'Hôtel Dieu 86022 POITIERS Cedex
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121769 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 9 months ago #121770 by Remundo
I saw but it was only in relation to mouse movement and not if only changes the value at the keyboard!

Rémi B.
Technicien en production, traitement, analyse de données et enquêtes
Observatoire de la réussite et de la vie étudiante (OREVE)
15, Rue de l'Hôtel Dieu 86022 POITIERS Cedex
The topic has been locked.
More
8 years 9 months ago #121771 by Remundo
keyup is good :-)

Rémi B.
Technicien en production, traitement, analyse de données et enquêtes
Observatoire de la réussite et de la vie étudiante (OREVE)
15, Rue de l'Hôtel Dieu 86022 POITIERS Cedex
The topic has been locked.
More
8 years 7 months ago #122855 by jph123
Hi,

I too am having problems with this script on internet explorer 11. I've tried changing the file as suggested in the thread but this hasn't worked for me.
" If I add to template startpage.pstpl
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
then this script work on IE10 "
The beginning of my startpage.pstpl now reads:
<!--<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
<title>{SURVEYNAME} – {GROUPNAME}</title>
Is this correct or is there something else that needs to happen. (Script works fine in firefox and chrome)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #122856 by tpartner

I too am having problems with this script on internet explorer 11. I've tried changing the file as suggested in the thread but this hasn't worked for me.

What LimeSurvey version are you using? Did you try the latest attached .lss file with the default template?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 7 months ago #122859 by jph123
Version 2.05+ Build 150508 currently but can upgrade to the latest build if that will fix it. Not sure where / what the lss files are. I only see css and pstpl files in the template editor?
The topic has been locked.
More
8 years 7 months ago #122872 by jph123
Hi,

I've worked out why mine isn't working. I'm using a numerical input box for the number and this doesn't work on internet explorer for your lss file (test 3) if I change the input box from short text. Is there anything that can be done to tweak the script so this works or do I need to change the input fields to short text?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago - 8 years 7 months ago #122880 by tpartner
Hmm...it seems that the built-in JS for enforcing numerics is conflicting in IE.

If you don't want to use short-text, how about a list (dropdown)?

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function(){
 
    // Identify the questions
    var q1ID = '{QID}';
    var q1 = $('#question'+q1ID+'');
    var q2 = $(q1).nextAll('.array-multi-flexi-text:eq(0)'); 
    var q2ID = $(q2).attr('id').split('question')[1];
 
    // Initial row handling
    handleRows($('.answer-item select', q1));
 
    // Listener on the numeric input
    $('.answer-item select', q1).change(function() {
      handleRows(this);
    });
 
    function handleRows(el) {
      var numRows = $(el).val();
      $('tr.subquestion-list', q2).hide();
      $('tr.subquestion-list', q2).each(function(i){
        if(i >= numRows) {
          $('input[type="text"], select', this).val('');
        }
        else {
          $(this).show();
        }
      })
    }
  });
</script>

File Attachment:

File Name: limesurvey...7(2).lss
File Size:22 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 7 months ago by tpartner.
The topic has been locked.
More
4 years 8 months ago #186086 by achecchini
This is an oldies reply but always goodies!!
What if the question is a radio button, so if I chek the first radio button the rows in array must be three (3), on the second check six, (6) on thirth ten (10) ??
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago #186091 by tpartner
You don't need this script in recent versions of LimeSurvey - you have sub-question relevance to handle it for you.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose