Welcome to the LimeSurvey Community Forum

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

Change in input box length for an array text question type

More
9 years 8 months ago #110532 by jpw
Does anyone have a workaround for an array text question which has multiple columns but different input box lengths for each column? There is an option in advanced settings to set the input box width but how do you set a different width for column2/column3/etc.?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 8 months ago #110627 by tpartner
Set up your survey to use JavaScript and add something like this to the source of the array:

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() { 
 
    // Identify this question
    var thisQuestion = $('#question'+{QID}+'');
 
    // Add some column-specific classes
    $('table.subquestions-list tr', thisQuestion).each(function(i){
      $('> *', this).each(function(i){
        $(this).addClass('column-'+i);
      });
    });
 
    // Adjust the input sizes
    $('.column-2 input[type="text"]', thisQuestion).attr('size', 25);
    $('.column-3 input[type="text"]', thisQuestion).attr('size', 5);   
 
  });
</script>

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