Welcome, Guest
Username: Password: Remember me

TOPIC: conditions on subquestion

conditions on subquestion 2 years 11 months ago #69758

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: 2 years 11 months ago by zahidansari.
The administrator has disabled public write access.

Re: conditions on subquestion 2 years 11 months ago #69764

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5349
  • Thank you received: 299
  • Karma: 250
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)limesurvey.org'"
The administrator has disabled public write access.

Re: conditions on subquestion 2 years 11 months ago #69772

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 administrator has disabled public write access.

Re: conditions on subquestion 2 years 11 months ago #69774

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4293
  • Thank you received: 810
  • Karma: 373
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.

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: conditions on subquestion 2 years 11 months ago #69775

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: 2 years 11 months ago by zahidansari.
The administrator has disabled public write access.

Re: conditions on subquestion 2 years 11 months ago #69776

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4293
  • Thank you received: 810
  • Karma: 373
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.

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: conditions on subquestion 2 years 11 months ago #69777

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 administrator has disabled public write access.

Re: conditions on subquestion 2 years 11 months ago #69778

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4293
  • Thank you received: 810
  • Karma: 373
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.

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: conditions on subquestion 2 years 11 months ago #69779

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4293
  • Thank you received: 810
  • Karma: 373
By "answer code", I mean these:

Capture_2011-11-24.PNG
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: conditions on subquestion 2 years 11 months ago #69819

Thanks mazi and tpartner for making my day.... :D ...


Please see page 2 for the issue on hiding question
Last Edit: 2 years 11 months ago by zahidansari.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.126 seconds
Donation Image