Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Pre-set answer in radioboxes array

Pre-set answer in radioboxes array 2 years 3 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 2 years 3 months ago #57602

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 2936
  • Thank you received: 446
  • Karma: 253
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

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