Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Array dual scale - make one answer scale not mandatory

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #103929

  • firzen
  • firzens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Is it possible to make one of the answer scales non mandatory? I have a 1 to 5 scale and the other scale will have a single optional answer option in it. I originally had a not applicable answer option in the second scale but users found it annoying to select two options for the 24 sub-questions
Letzte Änderung: 1 Jahr 2 Monate her von firzen.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #103944

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4646
  • Dank erhalten: 928
  • Karma: 408
You can't really make one answer non-mandatory and the problem with only providing one option for that scale is that if respondents mistakenly click it, they cannot un-click it.

I would keep the "N/A" option in the second scale and insert some JavaScript to click that option by default.

Add this script to the source of the array:

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Identify the second scale answers
		$('.answer-item[class^="answer_cell_2"]', thisQuestion).addClass('scale-2-item');
 
		// Set a default answer for the second scale
		$('.answers-list', thisQuestion).each(function(i) {
			if($('.scale-2-item input[type="radio"]:checked', this).length == 0) {
				$('.scale-2-item input[type="radio"]:last', this).click();
			}
		});
	});
 
</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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #103982

  • firzen
  • firzens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Thanks for this, but i can't seem to get the script working. Where exactly do i place the script? i tried putting it inside the not applicable answer option source and it didn't work. Was it suppose to go somewhere else? And i changed the QID to the relevant id.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #103989

  • firzen
  • firzens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Got it working, just had to remove the comments.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #104001

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4646
  • Dank erhalten: 928
  • Karma: 408
The script should be placed in the source of the array QUESTION TEXT.

If placed there, you will not need to replace "{QID}" and should not need to remove the comments.

.
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.
Letzte Änderung: 1 Jahr 2 Monate her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #104009

  • Mazi
  • Mazis Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 5596
  • Dank erhalten: 319
  • Karma: 255
Great solution, Tony.

Did you already add this to the workaround section? Might be really useful for others!

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'"
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #104103

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4646
  • Dank erhalten: 928
  • Karma: 408
I have added this to the workarounds with an improved script that allows selecting either scale and a column of that scale to be default - manual.limesurvey.org/Workarounds:_Manip...scale_Array_Question.

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
 
		// Scale to set the default answer on
		var defaultAnsweredScale = 2; 
		// Column of that scale to set as default answer
		var defaultAnsweredColumn = 3;
 
		// Identify this question
		var thisQuestion = $('#question{self.qid}');
 
		// Identify the scales and columns
		$('.answer-item[class^="answer_cell_1"]', thisQuestion).addClass('scale-1-item');
		$('.answer-item[class^="answer_cell_2"]', thisQuestion).addClass('scale-2-item');
		$('tr.answers-list', thisQuestion).each(function(i) {
			$('.scale-1-item', this).each(function(i) {
				$(this).addClass('scale-1-column-'+(i+1)+'-item');
			});
			$('.scale-2-item', this).each(function(i) {
				$(this).addClass('scale-2-column-'+(i+1)+'-item');
			});
		});
 
		// Click the default answers
		$('tr.answers-list', thisQuestion).each(function(i) {
			if($('.scale-'+defaultAnsweredScale+'-item input[type="radio"]:checked', this).length == 0) {
				$('.scale-'+defaultAnsweredScale+'-column-'+defaultAnsweredColumn+'-item input[type="radio"]:last', this).click();
			}
		});
	});
</script>

Sample survey:

Dateianhang:

Dateiname: dual_scale_with_default_answers.lss
Dateigröße: 20 KB


.
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Jahr 2 Monate her #104105

  • Mazi
  • Mazis Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 5596
  • Dank erhalten: 319
  • Karma: 255
Thanks a lot!

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'"
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Tag 23 Stunden her #118779

  • Tascja
  • Tascjas Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Hi Tony,
Your solution to the problem is what I am looking for. I have a dual array scale (first is quantity and second is frequency) and would like it to be automatic that when someone selects none for quantity, never in frequency is automatically selected.
Here is my problem: I cannot use JavaScript. The administrators would like to avoid activating this feature.
Do you know if there is a way to accomplish this same thing but with Expression Manager and/or equations?

Thanks in advance for your help :)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array dual scale - make one answer scale not mandatory 1 Tag 23 Stunden her #118780

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4646
  • Dank erhalten: 928
  • Karma: 408
No, sorry, I don't know of any way to do it with EM.
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.159 Sekunden
Donation Image