Check out the LimeSurvey source code on GitHub!

Pre-set answer in radioboxes array

More
5 years 11 months ago #57590 by martijntk
Regarding a social network analysis questionnaire, I would like to use an array-like approach

WEEKLY MONTHLY NEVER
name 1
name 2
name 3
...
name 300

The option "never" should be pre-set standard, because it is likely that respondents know a few of the others and will have to select only a few names. Is it possible to have the radioboxes under "NEVER" all checked standard?

Please Log in to join the conversation.

More
5 years 11 months ago #57602 by tpartner
If you're using a simple array with radio buttons, the following should work.

Set up your survey to use JavaScript and place the following script in the source of the array question. Replace "QQ" with the array question ID.

The script will loop through all rows and if no checked radios are found, the last one in that row will be checked.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		var qID = QQ;
 
		$('#question'+qID+' table.question tbody tr').each(function(i) { 
			if($('input.radio:checked', this).length < 1) {
				$('input.radio:last', this).attr('checked', true);
			}
		});
	});
 
</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.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form