Change in input box length for an array text question type

More
2 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.?

Please Log in to join the conversation.

More
2 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:

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

Please Log in to join the conversation.