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

TOPIC: Repeat answer list for Multiple Numerical input

Repeat answer list for Multiple Numerical input 3 years 4 months ago #59872

  • asonimie
  • asonimie's Avatar
Basically what I'm trying to do is an array filter for the Multiple numerical input. I know that's not an option but is there some way to replicate what array filter does?

I have a question that asks what brands people purchase.

I want to follow that question up with a question asking of the brands you mentioned how many would you buy of each?

Right now I am using INSERTANS from the previous question but that lists all the boxes, and anyone that wasn't checked appears as "no answer"

I want the 'no answer' boxes to go away.

fpitesters.limeask.com/index.php?sid=17261&newtest=Y&lang=en

There's an example of what I'm talking about.
The administrator has disabled public write access.

Re: Repeat answer list for Multiple Numerical input 3 years 4 months ago #59880

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4141
  • Thank you received: 768
  • Karma: 349
This is untested but should work in your demo suvey. If "No answer" is found, the row is hidden and the input is set to 0.

If you move to another survey or group you will need to modify the IDs in these lines:
"hideRows(27268);" - question ID
"calculateValue17261X939X27268(1);" - survey, group and question IDs
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		hideRows(27268);
 
		function hideRows(q1ID) {
 
			// Loop through all Q1 sub-questions
			$('#question'+q1ID+' li').each(function(i) {
 
				if($('label', this).text() == 'No answer') {
					$(this).hide();
					$('input.text', this).val(0);
				}
 
			});
 
			calculateValue17261X939X27268(1); // NOTE: this needs to use local survey, group and q2 question IDs
		}
	});
 
</script>
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: Repeat answer list for Multiple Numerical input 3 years 4 months ago #59901

  • asonimie
  • asonimie's Avatar
That worked perfectly. Thanks so much.
The administrator has disabled public write access.

Re: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60037

  • asonimie
  • asonimie's Avatar
I'm running into a weird issue now. I have a larger list of 30 options, and sometimes when people go through, options they didn't select are showing up, or options are being put together so it's Answer 1 & Answer 2. But those are separate answers on the question.

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

hideRows(28604);

function hideRows(q1ID) {

// Loop through all Q1 sub-questions
$('#question'+q1ID+' li').each(function(i) {

if($('label', this).text() == 'No answer') {
$(this).hide();
$('input.text', this).val(0);
}

});

calculateValue94256X980X28604(1); // NOTE: this needs to use local survey, group and q2 question IDs
}
});

</script>

Any idea what would be causing this?
Attachments:
The administrator has disabled public write access.

Re: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60038

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4141
  • Thank you received: 768
  • Karma: 349
That seems to be a problem with the {INSERTANS} you are using to populate the labels. If the option in the previous multiple-options was not selected, the label should be "No answer".

The script above does not modify the labels.
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: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60042

  • asonimie
  • asonimie's Avatar
I'm not sure I'm following you. I'm using INSERTANS so if a box was not checked on the previous question, the option then becomes (by limes default) no answer, instead of being the answer.

So if someone checks barefoot on the previous question, it will show up as barefoot on the followup question, if they don't select barefoot, it will show up as No answer.

Can you elaborate some more on what you mean?

I understood the script to look at what is presented on the page, if an answer is no answer, it hides that, if it's something else, it shows it.

Are you saying that the INSERTANS might just not be working correctly? i.e. it is not marking answers as 'no answer' when it should be?
The administrator has disabled public write access.

Re: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60044

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4141
  • Thank you received: 768
  • Karma: 349
Are you saying that the INSERTANS might just not be working correctly? i.e. it is not marking answers as 'no answer' when it should be?
Yes, that's what it looks like to me from your images.
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: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60045

  • asonimie
  • asonimie's Avatar
Could this cause the issue of the answers being joined with '&' too?
The administrator has disabled public write access.

Re: Repeat answer list for Multiple Numerical input 3 years 4 months ago #60076

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4141
  • Thank you received: 768
  • Karma: 349
Yeah, probably. Can you test a copy of the survey with the javaScript removed?
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: Repeat answer list for Multiple Numerical input 3 years 3 months ago #60741

  • asonimie
  • asonimie's Avatar
How would I make the script look for more than one answer to hide, so if one answer is Probably will buy, I want to hide that, and if another answer is May or may not buy, I want to hide that too.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.123 seconds
Donation Image