Welcome, Guest
Username: Password: Remember me

TOPIC: Change in input box length for an array text question type

Change in input box length for an array text question type 3 months 6 hours ago #110532

  • jpw
  • jpw's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
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 administrator has disabled public write access.

Change in input box length for an array text question type 2 months 4 weeks ago #110627

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
Set up your survey to use JavaScript and add something like this to the source of the array:

<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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.095 seconds
Donation Image