Welcome, Guest
Username: Password: Remember me

TOPIC: dummy fill from another question

dummy fill from another question 3 years 5 months ago #58141

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
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
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58148

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4118
  • Thank you received: 760
  • Karma: 346
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58152

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
Hi Tony:

They question are list radio and they are different page.

Rafael
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58153

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2608
  • Thank you received: 302
  • Karma: 111
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58155

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4118
  • Thank you received: 760
  • Karma: 346
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58156

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
But with INSERTANS show value no save (the second question is hide).

Rafael
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58157

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2608
  • Thank you received: 302
  • Karma: 111
Sorry, what? ;-)
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58158

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
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
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58160

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4118
  • Thank you received: 760
  • Karma: 346
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: dummy fill from another question 3 years 5 months ago #58161

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
Hi Tony,

Thanks a lot. I'll try it. It's very complicated!!
Rafael
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.126 seconds
Donation Image