Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

conditions on subquestion

  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago - 12 years 11 months ago #69758 by zahidansari
conditions on subquestion was created by zahidansari
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: 12 years 11 months ago by zahidansari.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 11 months ago #69764 by Mazi
Replied by Mazi on 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
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago #69772 by zahidansari
Replied by zahidansari on 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;
}
});
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 11 months ago #69774 by tpartner
Replied by tpartner on 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:
Code:
Fire the conditions function

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago - 12 years 11 months ago #69775 by zahidansari
Replied by zahidansari on 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
Code:
 
var sID = 31788;
var gID = 814;
var qHiddenID = 14257;
var answerCode = tmp2[1];
 
  // Fire the <a href='https://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: 12 years 11 months ago by zahidansari.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 11 months ago #69776 by tpartner
Replied by tpartner on 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.
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago #69777 by zahidansari
Replied by zahidansari on 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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 11 months ago #69778 by tpartner
Replied by tpartner on 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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 11 months ago #69779 by tpartner
Replied by tpartner on 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.
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago - 12 years 11 months ago #69819 by zahidansari
Replied by zahidansari on 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: 12 years 11 months ago by zahidansari.
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago #69820 by zahidansari
Replied by zahidansari on topic conditions on subquestion
Well I thought my problem is over but its working fine when the question is not hidden. When I hide the question using advanced setting-> always hide this question. The array filter does not seems to work.

I checked the html source and it seems the question itself is not there in the html!!
The topic has been locked.
  • zahidansari
  • zahidansari's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
12 years 11 months ago - 12 years 11 months ago #69821 by zahidansari
Replied by zahidansari on topic conditions on subquestion
Use

var qHiddenID = 14257;
$('#question'+14257+'').hide();



where qHiddenID is your question id

to hide your question
Last edit: 12 years 11 months ago by zahidansari.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose