Welcome, Guest
Username: Password: Remember me

TOPIC: Pre-set answer in radioboxes array

Pre-set answer in radioboxes array 3 years 7 months ago #57590

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

Re: Pre-set answer in radioboxes array 3 years 7 months ago #57602

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4264
  • Thank you received: 801
  • Karma: 368
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.

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.108 seconds
Donation Image