Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Please Help, hidden question with answers

Please Help, hidden question with answers 3 years 6 months ago #90696

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Hello again my friends, I need help with my survey.

So I have 2 questions, one question I choose from multiple choices, and depending those choices the second question is diferent, so far so good.

But now I already have the answers to my first question, so I want to hide that question, and I put the answers in Limesurvey and save them. And now this is my problem, my second question depends from the choices of the first question, but when I hide it with the saved answers, when I star the survey, and only my second question appears it does not shows me the question depending on the answers of the first question.

Sorry for my english, I hope you andurstand my problem. When I start the survey it shows the second question, that is good, but it should only show the matching answer optinos in this question.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #90739

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Can someone help?
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #90784

  • DenisChenu
  • DenisChenu's Avatar
  • Online
  • Moderator Lime
  • Posts: 9254
  • Thank you received: 1318
  • Karma: 382
What is the first question type and the 2nd question type ?

Maybe you can use "Array filter" if the question type is OK.

Denis
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #90961

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
No, thtat's not the problem, my problem is I import the responses to lomesurvey, in this case the reso«ponses to a multiple choice question, and when I go and do the survey he doesn't save the answers.

So, my problem is not the hidden answers, the problem is importing the answers.
Last Edit: 3 years 6 months ago by Serafim.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #90969

  • DenisChenu
  • DenisChenu's Avatar
  • Online
  • Moderator Lime
  • Posts: 9254
  • Thank you received: 1318
  • Karma: 382
You need Token to do that, and a "not anonymous survey".

After you can add attribute with information: this attribute can be default answer OR you can use condition on ATTRIBUTE.

Denis
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.
The following user(s) said Thank You: Serafim

Please Help, hidden question with answers 3 years 6 months ago #90970

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
But how do I put the attribute as the default answer?

My first question is a multiple choice question, and the second is a grid to choose from 1 to 5.

In my first question I questuio the person wich department does he changes mail and those answers I already have.

Then in the second question, and depending on the departments he chose before, hw will rate them from 1 to 5.
Last Edit: 3 years 6 months ago by Serafim.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91001

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6111
  • Thank you received: 1356
  • Karma: 532
You could set the default answers by pre-filling the survey with the URL. (this also works for filtering arrays)

So, for example, a survey with the following properties:
- Survey ID 111111
- Group with ID 22
- A multiple choice question (departments) with ID 33 and sub-question codes D1, D2, D3, D4...
- A following array question (ratings), filtered by the multiple choice question

Then for a respondent with departments D1 and D3 as defaults, the URL would look something like:
http://yourDomain.com/index.php/survey/index/sid/111111/lang/en?111111X22X33D1=Y&111111X22X33D3=Y

And to hide the question, add something like this to the end of template.css:
 
#question33 {
	position: absolute;
	left: -9999em;
}
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 6 months ago by tpartner.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91006

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Sorry but I'm very noob, where do I put that link (URL)?
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91007

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6111
  • Thank you received: 1356
  • Karma: 532
That would be the link to your survey. It's an alternative to using tokens.
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.

Please Help, hidden question with answers 3 years 6 months ago #91009

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Ah, ok. But then I had t stop using tokens, I understand. Thanks, but I need another solution, I have a lot of tokens in mu survey.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91054

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6111
  • Thank you received: 1356
  • Karma: 532
Okay, can you give me examples of the token attribute(s) used for the departments?
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.

Please Help, hidden question with answers 3 years 6 months ago #91086

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
ok, so it would be something like this:
Token 1:
attribute_1attribute_2attribute_3attribute_4
Dep1Dep3
Token 2:
attribute_1attribute_2attribute_3attribute_4
Dep2Dep4

Token 1 would have attribue_1 and attibute_3 for example, and token 2 the other 2 attributes.

When token 1 would answer the survey we would rate from 0 to 10 only Dep1 and Dep3.

One other thing I remembered, but don't no if it is possible, is this:

Token 1:
attribute_Dep1attribute_Dep2attribute_Dep3attribute_Dep4
YNYN
Token 2:
attribute_Dep1attribute_Dep2attribute_Dep3attribute_Dep4
NYNY
Don't no witch way is better. this is making my head spin...
Last Edit: 3 years 6 months ago by Serafim.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91121

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6111
  • Thank you received: 1356
  • Karma: 532
I would use the second example of your tokens:
attribute_1attribute_2attribute_3attribute_4
Token 1YNYN
Token 2NYNY

Then, place the multiple choice question (departments) in a group BEFORE the array (ratings) question and add this to the question source of the multiple choice question. It will hide the question and toggle the checkboxes according to the attribute values.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Get the question ID and the token values
		var qID = '{QID}';
		var dept1 = '{TOKEN:ATTRIBUTE_1}';
		var dept2 = '{TOKEN:ATTRIBUTE_2}';
		var dept3 = '{TOKEN:ATTRIBUTE_3}';
		var dept4 = '{TOKEN:ATTRIBUTE_4}';
 
		// Hide the question
		$('#question'+qID).css({
			'position':'absolute',
			'left':'-9999em'
		});
 
		// Check the appropriate boxes
		if(dept1 == 'Y') {
			$('#question'+qID+' input[type="checkbox"]:eq(0)').attr('checked', true);
		}
		if(dept2 == 'Y') {
			$('#question'+qID+' input[type="checkbox"]:eq(1)').attr('checked', true);
		}
		if(dept3 == 'Y') {
			$('#question'+qID+' input[type="checkbox"]:eq(2)').attr('checked', true);
		}
		if(dept4 == 'Y') {
			$('#question'+qID+' input[type="checkbox"]:eq(3)').attr('checked', true);
		}
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 6 months ago by tpartner.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 6 months ago #91133

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Oh, I see. I understand the code, that as to work. I'm just waiting for someone to give me admin privileges to try it. With the user I have can´t insert code in the questions.

Many thanks.
The administrator has disabled public write access.

Please Help, hidden question with answers 3 years 5 months ago #91691

  • Serafim
  • Serafim's Avatar
  • Offline
  • Expert Lime
  • Posts: 115
  • Thank you received: 2
  • Karma: 2
Hi there,

finally I've tried the code, and it works just fine, just have one question.

The code only works if I have question by question or group by group, if I have the survey to show all the questions in the same screen it doesn't work, but that's no problem, I just to change my survey to question by question.

What I can't change is that when the code hides the question, in my survey will have an empty screen, did I do something wrong or is there any solution?

Once again thanks.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.314 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form