Check out the LimeSurvey source code on GitHub!

dummy fill from another question

More
5 years 11 months ago #58141 by rafael_ur
Hello everyone.
I need prefill a dummy question to a previous question but but I can not.
I tried:
<script>
<!--
function Custom_On_Load(){
document.getElementById('answer73712X11X1080').value='#answer73712X10X1072';
}
-->
</script>
and the same with:
document.getElementById('answer73712X11X1080').value='answer73712X10X1072';
Thank you very much for your help
Rafael

Please Log in to join the conversation.

More
5 years 11 months ago #58148 by tpartner
What question types are they?

Are they on the same page?

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.

More
5 years 11 months ago #58152 by rafael_ur
Hi Tony:

They question are list radio and they are different page.

Rafael

Please Log in to join the conversation.

More
5 years 11 months ago #58153 by holch

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 11 months ago #58155 by tpartner

Wouldn't INSERTANS work for you?

Yep, you beat me to it Hoch :cheer:

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.

More
5 years 11 months ago #58156 by rafael_ur
But with INSERTANS show value no save (the second question is hide).

Rafael

Please Log in to join the conversation.

More
5 years 11 months ago #58157 by holch
Sorry, what? ;-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 11 months ago #58158 by rafael_ur
Holch,

I'm afraid (my English is bad). I need that second question (hide) saves the answer from the previous question. The second question is in different page.
Thanks.
Rafael

Please Log in to join the conversation.

More
5 years 11 months ago #58160 by tpartner
Well, assuming the two questions have identical answer labels, inserting the following script in the source of Q2 will:

1) Hide Q2

2) Check the same radio button in Q2 as was checked in Q1 (on previous page)

The script gets the answer to Q1, finds an identical answer label in Q2 and checks the corresponding radio button.

Replace the following
- SSSSS = survey ID
- GG = group 1 ID
- 11 = Q1 ID
- 22 = Q2 ID
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var q1Ans = '{INSERTANS:SSSSSXGGX11}';
		var q2ID = 22;
 
		// Hide the hidden question
		$('#question'+q2ID+'').hide();
 
		// Check the same option in Q2 as was checked in Q1
		var el = $('#question'+q2ID+' label').filter( function (index) { return $(this).text() == q1Ans; })
		$(el).siblings('input.radio').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.

More
5 years 11 months ago #58161 by rafael_ur
Hi Tony,

Thanks a lot. I'll try it. It's very complicated!!
Rafael

Please Log in to join the conversation.

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