Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Prefill for Array(Numbers)

Prefill for Array(Numbers) 1 Jahr 2 Monate her #100109

  • OlgaN
  • OlgaNs Avatar
  • Fresh Lemon
  • Beiträge: 1
  • Karma: 0

I have two columns and several rows in a question of type Array(Number), each answer drop-down list contains 60 options, which are numbers from 1 to 60. I would like to pre-fill all the drop-down lists so when the page is loaded they already have zeros as chosen options.

I tried two ways but non of them is working:

document.getElementById("#answer{SID}X{GID}X{self.qid}SQ001_SQ001").value = "0";


var selectId = 'answer{SID}X{GID}X{self.qid}SQ001_SQ001';
var defaultVal = 'input[id='+selectId+']';

Could you, please, help me to find out what I am doing wrong and how it should be.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Prefill for Array(Numbers) 1 Jahr 1 Monat her #100199

  • tpartner
  • tpartners Avatar
  • LimeSurvey Team
  • Beiträge: 4364
  • Dank erhalten: 827
  • Karma: 381
Try this:

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
		var thisQuestion = $('#question{QID}');
		$('select', thisQuestion).each(function(i) {
			if($(this).val() == '') {
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: OlgaN
Moderatoren: ITEd
Ladezeit der Seite: 0.137 Sekunden
Donation Image