Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Answer sourcing to question - hide space and get content in "others"

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74144

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
I am using version 1.91 and build 10089 in Google Chrome
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74146

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
Hmm...the attached modified survey works for me in Chrome too.

Can you activate a test survey for us to try?
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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74206

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
Survey Link is: 61.8.152.152/survey/index.php?sid=33888&lang=en

I also need another help in Q4 (last question in the last page).

In that question respondents are rating 3 brands - 1 chosen and 2 considered, on set of parameters. If I can have boxes to insert the names of the brands before going for rating it would be great. I cannot change the numerical drop down to a text box as the parameters are randomized to avoid bias, and the respondents would have to search for the text box to insert the name.

Please help.
[attachment:1]limesurvey_survey_33888.lss[/attachment]

Survey attached.

Thanks.
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74207

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
Survey Attached
Attachments:
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74308

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
I am using version 1.91 and build 10089 in Google Chrome
Updating to the latest version should fix the problem of the "Other" text not appearing. Test here with 1.91 (12416) - www.partnersinc.biz/surveys//index.php?s...88&newtest=Y&lang=en

I see another small problem though: If you select "Wild Fire" in page 1, then "C510" will appear in page 2. This appears to be a bug with INSERTANS whe using numerics for answer codes and having more that 10. Try changing the answer codes in the multiple-options from 1-22 to A-W (use alphas).
Cheers,
Tony Partner

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

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74309

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
I can have boxes to insert the names of the brands before going for rating it would be great.
Does this mean that you want text inputs here?

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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74312

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
Yes. If that is feasible.

But it looks complicated to me as it is part of the question options but the options change for every respondent.
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74316

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
If you suggest any other options that is close to providing this result is also fine.

Thanks :)
Last Edit: 4 years 6 months ago by Newbeedu.
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74323

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
Well, you could place a multiple-text question with 3 fields before the array and then use JavaScript to hide it and move the text inputs into the header cells of the array.

Presumably, you would also need some JavaScript to validate any value that the respondent enters - to make sure that it is actually one of their chosen or considered brands.

Would something like that suit?
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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74339

  • Newbeedu
  • Newbeedu's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
This solution sounds good.

However, with my limited abilities in javascript, am neither able to visualize the question format nor the output file.
Till the time it does not create any issues with the way i get output from the survey and keeps it simple, I am fine with any modification/hiding in the survey.
The administrator has disabled public write access.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74382

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5984
  • Thank you received: 368
  • Karma: 260
You're welcome :-)

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74431

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
This solution sounds good.
Yeah, it's a neat concept so I spent a little time on it.

1) Set up your survey to use JavaScript.

2) Insert a multiple-text question with 3 subquestions for the "Chosen Brand" and the two "Considered Brands" before the array question.

3) Add the following script to the source of the multiple-text question.

The script:
- Hides the multiple-text question
- Moves the multiple-text inputs to the array header cells
- Validates the "Chosen Brand" and "Considered Brand" inputs
- Ensures that all text fields are completed and the "Considered Brands" are - not the same.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		// Some alert messages
		var msg1 = 'That is not one of the chosen brands';
		var msg2 = 'That is not one of the considered brands';
		var msg3 = 'Please fill in all or the array headers.';
		var msg4 = 'The considered brands cannot be the same.';
 
		// An array containing the possible choices from page 1
		var brands = ['C510','K750I','W580I','J230','6600','N95','N97','N8','E7','S2','Note','Galaxy Y','Vaio','Mac','Net Book','Galaxy Tab','I Pad','Akash','Asha','Sensation','Wild Fire','1100','C2'];
 
		// An array containing the selected choices from page 1
		var chosenBrands = [];
		$('.numeric .questiontext li:not(:contains("No answer"))').each(function(i){
			chosenBrands.push($(this).text());
		});
 
		// An array containing all possible choices from page 1 with the selected removed
		var consideredBrands = brands;
		$(chosenBrands).each(function(i){
			var val = this;
			consideredBrands = $.grep(consideredBrands, function(element) { 
				return element != val; 
			});
		});
 
		// Hide the multiple-short-text
		$('.multiple-short-txt').hide();
 
		// Move the text inputs to the array header cells
		$('.multiple-short-txt input.text').each(function(i){
			$('.array-multi-flexi table.question thead th:eq('+i+')').append('<br />').addClass('header'+(i+1));
			$('.array-multi-flexi table.question thead th:eq('+i+')').append($(this));
		});
 
		// A listener to validate the "Chosen Brand" input
		$('.array-multi-flexi table.question thead input.text:eq(0)').change(function(){
			var validVal = 0;
			var inputVal = $(this).val().toLowerCase();
 
			// Loop through the chosenBrands and test the input value
			$(chosenBrands).each(function(i){
				if(inputVal == this.toLowerCase()) { // If a match is found...
					validVal = 1;
				}
			});
 
			// An invalid input
			if(validVal == 0) { 
				$(this).val('');
				alert (msg1);
			}
		});
 
		// A listener to validate the "Considered Brand" inputs
		$('.array-multi-flexi table.question thead input.text:eq(1), .array-multi-flexi table.question thead input.text:eq(2)').change(function(){
			var validVal = 0;
			var inputVal = $(this).val().toLowerCase();
 
			// Loop through the consideredBrands and test the input value
			$(consideredBrands).each(function(i){
				if(inputVal == this.toLowerCase()) { // If a match is found...
					validVal = 1;
				}
			});
 
			// An invalid input
			if(validVal == 0) { 
				$(this).val('');
				alert (msg2);
			}
		});
 
		// Interrupt next/submit function to make sure the array headers are completed
		$('#movenextbtn, #movesubmitbtn').click(function(){
			var emptyField = 0;
			$('.array-multi-flexi input.text').each(function(i){
				if($(this).val() == '') { 
					emptyField = 1;
					$(this).css({'background':'pink'});
				}
				else { 
					$(this).css({'background':''});
				}
			});
			if(emptyField == 1) {
				alert (msg3);
				return false
			}
			if($('.array-multi-flexi .header2 input.text').val().toLowerCase() == $('.array-multi-flexi .header3 input.text').val().toLowerCase()) {
				$('.array-multi-flexi .header2 input.text, .array-multi-flexi .header3 input.text').css({'background':'pink'});
				alert (msg4);
				return false
			}
		});
	});
 
</script>

Note: This script is designed for a group withe a single multiple-short-txt and a single array-multi-flexi question.

Here is a sample survey:

File Attachment:

File Name: modified_array.lss
File Size:58 KB


And a screenshot:
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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74434

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5984
  • Thank you received: 368
  • Karma: 260
Wow, this looks great.

-> workarounds... :-)

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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74443

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
-> workarounds...
Yeah, I thought it should go there but what to call it...

:lol:
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.

Answer sourcing to question - hide space and get content in "others" 4 years 6 months ago #74444

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6214
  • Thank you received: 1376
  • Karma: 539
... and it would be even better with the slider workaround - docs.limesurvey.org/Workarounds%3A+Quest...y-Dual-Scale-Numbers
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.
Moderators: ITEd
Time to create page: 0.320 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form