Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Inhibit sub-question of multi choice based on other sub questions checked

Inhibit sub-question of multi choice based on other sub questions checked 1 Jahr 7 Monate her #91653

  • ctdh
  • ctdhs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 5
  • Karma: 0
Hi
I have a 'simple' issue ;) I am struggling with...
A multi choice question:
Q1_SQ1 Choice A
Q2_SQ1 Choice B
Q3_SQ1 Choice C

I would like to be able to disable choice C if either A or B are selected

Can I do this in LS 2.00?

Thanks
Charles
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Inhibit sub-question of multi choice based on other sub questions checked 1 Jahr 7 Monate her #91662

  • ctdh
  • ctdhs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 5
  • Karma: 0
ok I have got this far
$(document).ready(function() {
 
		$('#answer537386X22X3129SQ3').change(function() {
			if ( $('#answer537386X22X3129SQ3').val() == 'Y' ) {
 				$('input[name="537386X22X3129SQ1"]').attr('disabled', 'disabled');
			}
		});
	});

The problem is that the if statement is always being triggered even when I uncheck #answer537386X22X3129SQ3

Any ideas what I need to do??

Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Inhibit sub-question of multi choice based on other sub questions checked 1 Jahr 7 Monate her #91668

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4139
  • Dank erhalten: 767
  • Karma: 348
It seems to me that your code is trying to disable choice "A", not choice "C".

If you want to disable "C" when "A" or "B" are selected:
	$(document).ready(function() {
 
		$('#answer537386X22X3129SQ1, #answer537386X22X3129SQ2').change(function() {
			if ( $(this).attr('checked') == true) {
				$('input[name="537386X22X3129SQ3"]').attr('disabled', 'disabled');
			}
			else {
				$('input[name="537386X22X3129SQ3"]').attr('disabled', '');
			}
		});
	});
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.198 Sekunden
Donation Image