conditions on subquestion

More
5 years 6 months ago - 5 years 6 months ago #69758 by zahidansari
zahidansari created the topic: conditions on subquestion
Hi,

I have a matrix type question :

(sample question)

q:Give point to mobile

1 2 3 4 5
nokia
samsung
motoroal

(1,2,3,4,5 will be on top as in matrix type question)

Now if the person select 1 for a mobile he should be shown next question like this:

Why do you like Nokia

Battery Looks weight Prce
nokia


How can I achieve this. One option I was thinking is add a hidded chckbox question whose option(nokia,sammsung,motorola) will be selected if option 1 from 1st question is chosen and then use array filter to show needed option in the next matrix question. Am I on the right path?
Last Edit: 5 years 6 months ago by zahidansari.

Please Log in to join the conversation.

More
5 years 6 months ago #69764 by Mazi
Mazi replied the topic: conditions on subquestion
Yes, the solution you are thinking of should work fine. There should even be some examples at the forum. Search for "array filter".


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 6 months ago #69772 by zahidansari
zahidansari replied the topic: conditions on subquestion
Hi Mazi

Thanks for the quick reply.

Well the checkbox is filling correctly but the next question is not showing any option. Currently I have made the checkbox question as visible and I can see that options are ticked correctly.

This checkbox question id is 2.2

In the next matrix type question I am giving Array filter = 2.2(Array exclusion is empty). But next question is shown without any options.

Will it help if I attach survey exported file??


For other peoples-JavaScript I used is given below:


$('form#limesurvey').submit(function(){
if(document.getElementById("answer31788X814X142411-A1"))
{
document.getElementById("answer31788X814X14257SQ001").checked=true;
}
});

Please Log in to join the conversation.

More
5 years 6 months ago #69774 by tpartner
tpartner replied the topic: conditions on subquestion
You need to fire checkconditions() after checking a box in the hidden question.

Have a look at this post - www.limesurvey.org/en/forum/can-i-do-thi...g-array-subquestions - search for:
Fire the conditions function

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 6 months ago - 5 years 6 months ago #69775 by zahidansari
zahidansari replied the topic: conditions on subquestion
I have used the below code but still it does not seems to work. I have given the code in the hidden question
 
var sID = 31788;
var gID = 814;
var qHiddenID = 14257;
var answerCode = tmp2[1];
 
	// Fire the <a href='http://docs.limesurvey.org/tiki-index.php?page=Setting%20conditions'>conditions</a> function to hide the corresponding row in Q2
 
var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
 
var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
 
var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
 
Last Edit: 5 years 6 months ago by zahidansari.

Please Log in to join the conversation.

More
5 years 6 months ago #69776 by tpartner
tpartner replied the topic: conditions on subquestion
Oh, wait, sorry, you don't need that if the hidden question and second array are on different pages.

Are the answer codes for the hidden question and second array identical?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 6 months ago #69777 by zahidansari
zahidansari replied the topic: conditions on subquestion
I dont know what you mean by answer code so I am attaching the survey extract.

Both matrix questions have the same option names though.
[attachment:1]limesurvey_survey_31788.lss[/attachment]

Not able to attach the file .its showing blank page.

Please Log in to join the conversation.

More
5 years 6 months ago #69778 by tpartner
tpartner replied the topic: conditions on subquestion
Try adding a .txt extension before attaching - so limesurvey_survey_31788.lss.txt

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 6 months ago #69779 by tpartner
tpartner replied the topic: conditions on subquestion
By "answer code", I mean these:


Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in to join the conversation.

More
5 years 6 months ago - 5 years 6 months ago #69819 by zahidansari
zahidansari replied the topic: conditions on subquestion
Thanks mazi and tpartner for making my day.... :D ...


Please see page 2 for the issue on hiding question
Last Edit: 5 years 6 months ago by zahidansari.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now