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

TOPIC: Can "INSERTANS" generate sub-question code instead of the sub question name ?

Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64777

  • rasheed
  • rasheed's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Thanks in advance for your feedback !
The administrator has disabled public write access.

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64781

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
For 1.91+, you'd probably have to use JavaScript.

For 1.92, you'll be able to use Expression Manager, which does let you insert the sub-question code.
The administrator has disabled public write access.
The following user(s) said Thank You: rasheed

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64786

  • rasheed
  • rasheed's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Thanks for your inputs.

I am using 1.91+, would please give me more details on how to use Javascript for that.

If it's complicated, could you please tell me how to move from 1;91 to 1.92 ?

Thank you
The administrator has disabled public write access.

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64793

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4068
  • Thank you received: 746
  • Karma: 341
The details of the JavaScript would depend on how you are using {INSERTANS}.

Are you using it in question text?

What template are you using.
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: rasheed

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64796

  • rasheed
  • rasheed's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Hi Tpartner,

Thanks for your help.

I am using {INSERTANS} to pass answers to another script at the end of the questionnaire.

In my questionnaire i am using Multi choice questions and drop down menus and i would like to pass the code of the sub-questions (for multi choice) and the options (for dorp down menus) not their content.

Template i am using is Redandgrey1.

Thank you in advance.
The administrator has disabled public write access.

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64808

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4068
  • Thank you received: 746
  • Karma: 341
Then you can simply map the answer text to the appropriate answer codes:
 
	var prevAns = '{INSERTANS11111X22X33';
 
	switch(prevAns) {
		case 'Answer text 1' :
			prevAns = 'answerCode1';
			break;	
		case 'Answer text 2' :
			prevAns = 'answerCode2';
			break;	
		case 'Answer text 3' :
			prevAns = 'answerCode3';
			break;	
	}
 
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: rasheed

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64811

  • rasheed
  • rasheed's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Thank you, i start seeing the light at the end of the tunnel :)

However, i a, to pass more than 5 variables (from multichoice and dorp down menu questions) and as i am not a javascript expert, i don't really see what will be the code (should i add new variable ? prevAns2,...?) and where to insert it (template code ?).

Thank you so much.
Last Edit: 2 years 11 months ago by rasheed.
The administrator has disabled public write access.

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64814

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4068
  • Thank you received: 746
  • Karma: 341
should i add new variable ?
Yes, something like:
	var prevAns1 = '{INSERTANS11111X22X33'; 
	var prevAns2 = '{INSERTANS11111X22X44'; 
	var prevAns3 = '{INSERTANS11111X22X55';
 
	switch(prevAns1) {
		case 'Q1 answer 1 text' :
			prevAns1 = 'q1Answer1Code';
			break;	
		case 'Q1 answer 2 text' :
			prevAns1 = 'q1Answer2Code';
			break;	
		case 'Q1 answer 3 text' :
			prevAns1 = 'q1Answer3Code';
			break;	
	}
 
	switch(prevAns2) {
		case 'Q2 answer 1 text' :
			prevAns2 = 'q2Answer1Code';
			break;	
		case 'Q2 answer 2 text' :
			prevAns2 = 'q2Answer2Code';
			break;	
		case 'Q2 answer 3 text' :
			prevAns2 = 'q2Answer3Code';
			break;	
	}
 
	switch(prevAns3) {
		case 'Q3 answer 1 text' :
			prevAns3 = 'q3Answer1Code';
			break;	
		case 'Q3 answer 2 text' :
			prevAns3 = 'q3Answer2Code';
			break;	
		case 'Q3 answer 3 text' :
			prevAns3 = 'q3Answer3Code';
			break;	
	}
 
and where to insert it
Wherever you have the script using INSERTANS now,
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: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64819

  • rasheed
  • rasheed's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
I am using at the END URL in fact :huh:
thankyou.php?prenom={INSERTANS:57582X46X2708}
The administrator has disabled public write access.

Re: Can "INSERTANS" generate sub-question code instead of the sub question name ? 2 years 11 months ago #64837

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4068
  • Thank you received: 746
  • Karma: 341
In that case, I think you will need to load a hidden question with the answer code(s) and then use INSERTANS for the hidden question in the end URL.
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.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.148 seconds
Donation Image