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

TOPIC: problems with javascript

problems with javascript 3 years 5 months ago #62331

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
you can take a value from a previous question and display it as radio type text according to a next question I was reading you can do with javascript, but the implementation of the code is not very clear, could help appreciated.

the example works as follows:

1 .- Question 1
option 1
option 2
option 3
2 .- Question 2
The value of option 1 is: (option1)

Thanks in advance
The administrator has disabled public write access.

Re: problems with javascript 3 years 5 months ago #62335

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
What are the 2 question types?

Q1 = Radio?
Q2 = Short text?
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: problems with javascript 3 years 5 months ago #62336

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
tpartner both questions are like:

Q1 = radio
Q2 = radio

Greetings, Thanks
The administrator has disabled public write access.

Re: problems with javascript 3 years 5 months ago #62337

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
Okay, but I'm not sure what you are trying to achieve. Can you supply a small sample survey and maybe screenshots?
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: problems with javascript 3 years 5 months ago #62340

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
friend sends you a snapshot, I hope you understand better idea.

Greetings, Thanks


pagina.jpg
Last Edit: 3 years 5 months ago by mattias.
The administrator has disabled public write access.

Re: problems with javascript 3 years 5 months ago #62397

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
tpartner

I want to accomplish is similar to this example, but you must load the value in the same section of the survey.

www.partnersinc.biz/surveys//index.php?s...52&newtest=Y&lang=en

I hope I have been a little clearer.

Greetings, Thanks
The administrator has disabled public write access.

Re: problems with javascript 3 years 5 months ago #62408

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
Oh, I see, something like {INSERTANS} but with both questions on the same page.

Set up your survey to use JavaScript.

Wrap the text in Q2 that is to be replaced in a span with a class "pipedText". So the source of that question should look something like:
The answer from a previous question on this page is: "<span class="pipedText">text to be replaced</span>".

Add the following script to the source of one of the questions. Replace "QQ" with the Q1 question ID.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qID = QQ; 
 
		$('#question'+qID+' input.radio').click(function(){
			$('.pipedText').text($(this).siblings('label').text());
		});
 
	});
 
</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.
The following user(s) said Thank You: mattias

Re: problems with javascript 3 years 5 months ago #62416

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
thank you very much my friend, it worked very well

thanks for your time and dedication, greetings from Chile.
The administrator has disabled public write access.

Re: problems with javascript 3 years 5 months ago #62419

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
No problem and regards from Ottawa, Canada.
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: problems with javascript 3 years 5 months ago #62444

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
friend

I have one last question on this topic, in case you want to do the same but one section of the survey would have to modify the QQ
eg: 1111X22X3 because this modification and do not work for me.

regards
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.147 seconds
Donation Image