Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: problems with javascript

problems with javascript 5 years 5 months ago #62449

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
If you want to do it to more questions on the same page, use something like the following.

The answer of question ID 11 will be piped into the text of questionID 22 and the answer of question ID 33 will be piped into the text of questionID 44.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		pipeText(11, 22);
		pipeText(33, 44); 
 
		function pipeText(q1ID, q2ID){
			$('#question'+q1ID+' input.radio').click(function(){
				$('#question'+q2ID+' .pipedText').text($(this).siblings('label').text());
			});
		}
 
	});
 
</script>


Add as many function calls as necessary:
		pipeText(11, 22);
		pipeText(33, 44);
		pipeText(55, 66);
		pipeText(77, 88);
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
The following user(s) said Thank You: mattias01

problems with javascript 5 years 5 months ago #62452

  • mattias01
  • mattias01's Avatar
  • Offline
  • Senior Lime
  • Posts: 79
  • Karma: 1
but my question is to work with different pages eg:

Page1

Q1 = Question 1
question 2

Q2 = the value of question 1 is: example (Question1)

page 2

Q3 = the value of question 1 is: example (Question 1)

I hope I have been more clear.

regards
The administrator has disabled public write access.

problems with javascript 5 years 5 months ago #62472

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
For questions on subsequent pages you don't need JavaScript. You can use {INSERTANS} - docs.limesurvey.org/Adding+a+question&hi...rom_previous_answers.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

problems with javascript 5 years 5 months ago #62488

  • mattias01
  • mattias01's Avatar
  • Offline
  • Senior Lime
  • Posts: 79
  • Karma: 1
thanks friend solved the problem with what I stated.

regards
The administrator has disabled public write access.
Time to create page: 0.442 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form