Preselected Answers in dual Array Questions

More
5 years 5 months ago - 5 years 5 months ago #73173 by bluesky
bluesky created the topic: Preselected Answers in dual Array Questions
Thx first of all for this great tool! This question is a copy of a question in the german forum, but the admin told me to post it here, to get some advise.

My Installation:
LimeSurvey Version + Build: Version 1.91+ Build 11804
Installation: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1/MySQL-Client-Version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735
Firefox 9.0.1

My Questions regarding to the atttached Survey for Project Selection of our NGO, targeting disabled in Vietnam.

1) I need to design the query in a way that each project is answered by each user. So one query should be saved for each user and each project. Of course I can simply have one query for each project instead of integrating this step in one survey (thats what I am planning to do right now, so if there is no solution within limesurvey to easily solve this, its fine with me. According to Mazi (German Forum) thats how it is ;)
What still would be very helpfull, if I just could check if there exits already a saved survey for the selected project, maybe this is easier and doable, so maybe any solution for this....


2) Most of my questions are Dual Array - dual scale, to enable comments. Additionally this questions are mandatory, but I would like to have the questions in the second array already preselected, meaning that in the design the option "no comment" is the default already entered, so it needs not to be selected by the user for each question. Is there a way to do this?

Thats it for now, the survey is attached. Thx for any help,

Dominik

cheers, Dominik
Attachments:
Last Edit: 5 years 5 months ago by bluesky.

Please Log in to join the conversation.

More
5 years 5 months ago #73175 by tpartner
tpartner replied the topic: Preselected Answers in dual Array Questions
Regarding #2, you can use JavaScript to preselect the last option of the second scale of an dual-scale-array.

Do you want this behaviour for all dual-scale-arrays in the survey or only selected questions.

Do you use a custom template?

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 5 months ago - 5 years 5 months ago #73176 by bluesky
bluesky replied the topic: Preselected Answers in dual Array Questions
I would need it for all questions in the array, but I am not sure on using Java Script in Limesurvey. Right now I am using the basic template, I still have to work on a final template selection.

cheers, Dominik
Last Edit: 5 years 5 months ago by bluesky.

Please Log in to join the conversation.

More
5 years 5 months ago #73178 by tpartner
tpartner replied the topic: Preselected Answers in dual Array Questions
To preselect the last option of the second scale of all dual-scale-arrays in the survey, add the following to your template.js file (you will need to copy a template for your survey):
$(document).ready(function() {
 
	preselectLast ();
 
	function preselectLast () {
 
		// Add some scale-specific classes to the answer cells
		$('.array-flexible-duel-scale tbody[id^="javatbd"] td').each(function(i){
			var scale = $(this).attr('class').substr(12,1);
			$(this).addClass('scale-'+scale);
		});
 
		// Preselect the last option of scale 2 (if nothing is already selected)
		$('.array-flexible-duel-scale tbody[id^="javatbd"]').each(function(i){
 
			if($('.scale-2 input.radio:checked', this).length == 0) {
				$('.scale-2 input.radio:last', this).attr('checked', true);
			}
		});
 
	}
 
});

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 5 months ago #73181 by bluesky
bluesky replied the topic: Preselected Answers in dual Array Questions
Great, just implemented it and works... thx a lot, that makes the survey a lot more user-friendly.

cheers, Dominik

Please Log in to join the conversation.

More
5 years 4 months ago #73209 by Mazi
Mazi replied the topic: Preselected Answers in dual Array Questions
you're welcome


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.

Start now!

Just create your account and start using Limesurvey today.

Register now