Welcome, Guest
Username: Password:

TOPIC: Using previous Array question responses to set following Array subquestions

Using previous Array question responses to set following Array subquestions 4 years 11 months ago #62842

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
Okay, now I'm confused about the total scope of the workaround. I don't see my latest code in that script.
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.

Using previous Array question responses to set following Array subquestions 4 years 11 months ago #62853

  • MaLu
  • MaLu's Avatar
  • Offline
  • Junior Lime
  • Posts: 35
  • Karma: 0
Oh, ok. Well, what I'm trying to do is to limit the size of some survey questions in rows and columns. I attached a screenshot what it should look like.

Following your previous script, the two multiple-option questions (x and x2) are both hidden (only for the test unhidden) and automatically filled by answering the array questions before them (Q1 respective Q4). For subsequent questions, I then used the filter option inserting x respective x2. So far the survey works perfectly.

In Q5, I’d like to limit both rows and columns. Hiding rows seems fairly easy using the filter again. Inserting your script to limit the columns, it only works, if I actively check or uncheck any box in x. Is it possible to transfer the automatically filled answers to Q5 as well?
I also attached the survey.

Well knowingly that I’m asking quite a lot, I hope you can help me out…

Best,
Marie
Attachments:
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 10 months ago #63148

  • MaLu
  • MaLu's Avatar
  • Offline
  • Junior Lime
  • Posts: 35
  • Karma: 0
Is there an option to simulate the click in the hidden question so it pretends to be actively clicked?

Appreciate all the help and comments I can get!
Marie
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 10 months ago #63196

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
Sorry Marie for the delay.

Remove all scripts in "x", "x2" and "Q5". Insert the following script in the source of "x". This script is an aggregation of the 3 that you were using with the countChecked() function modified to handle the hide/show columns part.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() { 
 
		// Call the show/hide rows function
		// Params - Array ID, Hidden question ID, Column question
		countChecked(1256, 846, 852);
		countChecked(1289, 1295);
 
		// Call the initialisation of the hide/show columns function
		// Params - the IDs of the checkbox question and the array question
		handleCols(846, 852);
 
		function countChecked(q1ID, qHiddenID, qColumns) {
 
			// Hide the hidden question
			//$('#question'+qHiddenID+'').hide();
 
			// Find the survey and group IDs
			if($('input#fieldnames').length != 0) {
				var fieldNames = $('input#fieldnames').attr('value');
				var tmp = fieldNames.split('X');
				var sID = tmp[0];
				var gID = tmp[1];
			}
 
			// A listener on the 1st column of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_00A1').click(function () { 
 
				// Uncheck the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false);
 
				// Fire the conditions function to hide the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType);
				if(qColumns) {
					hideShow(qHiddenID, qColumns);
				}
			});
 
			// A listener on the 2nd and 3rd columns of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_00A3, #question'+q1ID+' td.answer_cell_00A5').click(function () { 
 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true);
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType);
				if(qColumns) {
					hideShow(qHiddenID, qColumns);
				}
			});
		}
 
		// The initialisation of the hide/show columns function
		function handleCols(qCheckbox, qArray) {
 
			// Assign column-specific classes to answer cells of the "column" question
			$('#question'+qArray+' table.question thead th').each(function(i){
				$(this).addClass('ansCol'+i+'');
			});
			$('#question'+qArray+' table.question tbody').each(function(i){
				$('td', this).each(function(i){
					$(this).addClass('ansCol'+i+'');
				});
			});
 
			// Initially hide or show array columns depending on checkboxes
			hideShow(qCheckbox, qArray);
		}
 
		// A function to hide or show columns depending on checkboxes in a multi-opt question
		function hideShow(qCheckbox, qArray) {
 
			// Loop through all multi-opt checkboxes
			$('#question'+qCheckbox+' input.checkbox').each(function(i){
				if($(this).attr('checked') == true) {
					$('#question'+qArray+' .ansCol'+i+'').show();
				}
				else {
					$('#question'+qArray+' .ansCol'+i+'').hide();
					$('#question'+qArray+' .ansCol'+i+' input[type="checkbox"]').attr('checked', false);
				}
			});
		}
 
	});
 
</script>
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.
The following user(s) said Thank You: DenisChenu

Using previous Array question responses to set following Array subquestions 4 years 10 months ago #63198

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
Oh, and check those IDs in rows 7, 8 and 12. I'm pretty sure those are the IDs from your survey but you may need to change them if you have exported/imported the survey.
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.

Using previous Array question responses to set following Array subquestions 4 years 10 months ago #63217

  • MaLu
  • MaLu's Avatar
  • Offline
  • Junior Lime
  • Posts: 35
  • Karma: 0
Brilliant! That works perfectly now, just the way I wanted it to!!

And here’s my last question for now: Is it possible to show the questions one by one without paralysing the mechanism?

Thank you so much for your patient support! Hope I wasn’t bothering you too much…

Cheers,
Marie
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 10 months ago #63225

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
If you mean place the questions on different pages, no. The script can only manipulate question on the same page.
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.
The following user(s) said Thank You: MaLu

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #65993

  • Maximilien
  • Maximilien's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
Hi,

I had pretty much the same problem that the initial question described. I used the script you provided Tony, and I really thank you for all your work.

I have a little issue though, and I don't know how to fix it.
It appears that the listener
$('#question'+q1ID+' td.answer_cell_002').click(function () {

is listening on the cell of the array... Not on the checkboxes. My problem is that it works fine if the user (as most users do) clicks on the cell, but it fails if he clicks on the checkbox itself!
Quite trick. It's not too difficult to listen on a cell (all cells are identified by the same class "answer_cell_00xxx") but it looks more difficult to listen on the checkboxes of a column (they are identified by ids and names that differs from one to the other).

Am I missing something ?
Any idea to get this working ? (I do have users that click right on the checkbox sadly)

Thanks in advance,
Maximilien
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #65996

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8938
  • Thank you received: 1253
  • Karma: 371
Maybe something like that:
$('#question'+q1ID+' td.answer_cell_002, #question'+q1ID+' td.answer_cell_002 input:checkbox').click(function () {

The jquery api : api.jquery.com/
The administrator has disabled public write access.
The following user(s) said Thank You: Maximilien

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #66000

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
...is listening on the cell of the array... Not on the checkboxes.
This workaround is for array questions with radio buttons. What question type are you using?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 years 8 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: Maximilien

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #66052

  • Maximilien
  • Maximilien's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
Thanks Shnoulle, it worked !
I set up two listeners : one on the cell and one on the checkbox (using your code).

About the radio button Tony, I couldn't do that, I need to have checkboxes. It's an Array (Numbers) with a checkbox layout.

Another thing if you have some time (though it's not really important) :
I have Q1 which is this Array of checkboxes and Q2 which is another array depending on the results of the second column of Q1.
So Q2 rows only show when the equivalent row in Q1 column 2 is selected.
I used the following javascript code to get it to work using an hidden Multiple Options question.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Call the function
		// Params - Q1 ID, Q2 ID, Hidden question ID
		countChecked(529, 664, 4059);
 
		function countChecked(q1ID, q2ID, qHiddenID) {
 
			// Hide the hidden question
			$('#question'+qHiddenID+'').hide();
 
			// Find the survey and group IDs
			if($('input#fieldnames').length != 0) {
				var fieldNames = $('input#fieldnames').attr('value');
				var tmp = fieldNames.split('X');
				var sID = tmp[0];
				var gID = tmp[1];
			}
 
			// A listener on the 2nd of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_002').click(function () { 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true);
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
			$('#question'+q1ID+' td.answer_cell_002, #question'+q1ID+' td.answer_cell_002 input:checkbox').click(function () { 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true);
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
		}
 
	});
 
</script>

It works fine when the user checks a box in Q1 column2 : it displays the line in Q2. But
I would have liked to have some kind of toggle : if the user uncheck a box in column 2 of Q1 it should hide the correspondant row in Q2.
I tried this code that fails (it doesn't do anything - display or hide - but I can't understand why !) :
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Call the function
		// Params - Q1 ID, Q2 ID, Hidden question ID
		countChecked(529, 664, 4059);
 
		function countChecked(q1ID, q2ID, qHiddenID) {
 
			// Hide the hidden question
			$('#question'+qHiddenID+'').hide();
 
			// Find the survey and group IDs
			if($('input#fieldnames').length != 0) {
				var fieldNames = $('input#fieldnames').attr('value');
				var tmp = fieldNames.split('X');
				var sID = tmp[0];
				var gID = tmp[1];
			}
 
			// A listener on the 2nd of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_002').click(function () { 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
        if ($('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked') == true) {
				  $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false)
				} else {
				  $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true)
				} 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
			$('#question'+q1ID+' td.answer_cell_002, #question'+q1ID+' td.answer_cell_002 input:checkbox').click(function () { 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
        if ($('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked') == true) {
				  $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false)
				} else {
				  $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true)
				}
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
		}
 
	});
 
</script>

If you have any idea why it fails... ;-)
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #66090

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5909
  • Thank you received: 1295
  • Karma: 522
A couple of things:

1) You don't need the first listener - selectors for the cell and input elements are both included in the second listener.

2) There is a logic problem with the IF statement.

This is untested but try:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Call the function
		// Params - Q1 ID, Q2 ID, Hidden question ID
		countChecked(529, 664, 4059);
 
		function countChecked(q1ID, q2ID, qHiddenID) {
 
			// Hide the hidden question
			$('#question'+qHiddenID+'').hide();
 
			// Find the survey and group IDs
			if($('input#fieldnames').length != 0) {
				var fieldNames = $('input#fieldnames').attr('value');
				var tmp = fieldNames.split('X');
				var sID = tmp[0];
				var gID = tmp[1];
			}
 
			$('#question'+q1ID+' td.answer_cell_002, #question'+q1ID+' td.answer_cell_002 input:checkbox').click(function () { 
				// Check the corresponding option in the hidden question
				var parentRow = $(this).parents('tbody:eq(0)');
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				if ($('td.answer_cell_002 input:checkbox', parentRow).attr('checked') == true) {
					$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true)
				} else {
					$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false)
				}
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
		}
 
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 years 8 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: Maximilien

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #66177

  • Maximilien
  • Maximilien's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
Great Tony, Thanks ! I tested it and it works well.

I didn't see the logic problem, I guess I got lost in my toggle logic... Thank you very much for raising that !
The administrator has disabled public write access.

Using previous Array question responses to set following Array subquestions 4 years 8 months ago #66178

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5965
  • Thank you received: 364
  • Karma: 259
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.

Using previous Array question responses to set following Array subquestions 3 years 1 week ago #96315

  • StuTheQ
  • StuTheQ's Avatar
  • Offline
  • Junior Lime
  • Posts: 26
  • Karma: 0
Dear Tony,

Well, it only took me two years and two months to read your instructions and get round to implementing the JavaScript code that you gave me…!! :blush: (cf. your posts #58058, #58059 and my last reply #58062)

Seriously, I thought I was getting a bit out of my depth at that point and, given a number of other work and study issues that I had to sort out at the time, decided to come back to my LimeSurvey project when I could give it my full attention.

So, I’m back and 100% determined to get my LimeSurvey “Language needs analysis” up-and-running!! You’ve already given me a lot of your valuable time, Tony, but could I ask you just to help me out again with one or two issues? (hopefully you’ll see that I’m not wasting your time here).

I read to the end of the thread but think that MaLu’s case is the closest to mine, hence my new post just before her (final success) post #62558 (I've just seen that my new post has in fact been placed at the end of the thread...).

I’m now fully upgraded and running LimeSurvey 2.00+.

I set up a simple survey (‘Test’, file attached), with just one Question Group (file attached), to implement your JavaScript workaround (I checked to see if JavaScript was enabled: ‘Alert’ echo = OK)

In Question Group 1, I set up:
  • Q1 (an Array question with three answers (‘N/A’, ‘Important’ and ‘Priority) and four subquestions) (file attached)
  • qHidden (a Multiple Option question with the same four subquestions) (file attached)
  • Q2 (an Array question with five answers (‘I can’t’, ‘I can’t very well’, ‘I can’, ‘I can quite well’ and ‘I can very well’) and the same four subquestions) (file attached)
As per your instructions, Q2 has conditions so it is only shown if any option in qHidden is checked. Q2 also has a filter array so that only the subquestions checked in qHidden subsequently appear.

I previewed the questions individually and ran the survey and everything seemed to be OK. Time for the JavaScript code!

As you mentioned some previous edit errors (spaces and quotes) in your post #62555, I carefully copied and pasted the ‘definitive’JavaScript code that you gave to MaLu into the qHidden source (JavaScript code in .txt file attached)
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() { 
 
		// Call the function
		// Params - Q1 ID, Q2 ID, Hidden question ID
		countChecked(143, 158, 153);
 
		function countChecked(q1ID, q2ID, qHiddenID) {
 
			// Hide the hidden question
			$('#question'+qHiddenID+'').hide();
 
			// Find the survey and group IDs
			if($('input#fieldnames').length != 0) {
				var fieldNames = $('input#fieldnames').attr('value');
				var tmp = fieldNames.split('X');
				var sID = tmp[0];
				var gID = tmp[1];
			}
 
			// A listener on the 1st column of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_001').click(function () { 
 
				// Uncheck the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false);
 
				// Fire the conditions function to hide the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
 
			// A listener on the 2nd and 3rd columns of Q1 radio buttons 
			$('#question'+q1ID+' td.answer_cell_002, #question'+q1ID+' td.answer_cell_003').click(function () { 
 
				// Check the corresponding option in the hidden question
				var rowID = $(this).parents('tbody:eq(0)').attr('id');
				var tmp2 = rowID.split('X'+q1ID);
				var answerCode = tmp2[1];
				$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true);
 
				// Fire the conditions function to show the corresponding row in Q2
				var hiddenInputValue = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('value');
				var hiddenInputName = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('name');
				var hiddenInputType = $('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('type');
				checkconditions(hiddenInputValue, hiddenInputName, hiddenInputType)
			});
		}
 
	});
 
</script>
I then replaced MaLu’s question IDs with those from my ‘Test’ survey, double-checking to make sure that they were right (cf. your comment about common errors).

No joy. qHidden was hidden but Q2 was not activated. I removed the ‘Hide the hidden question’ JavaScript code to see if the checkboxes in qHidden were being checked. qHidden appeared but no checkboxes were checked.

Reading your post #62539, I then thought that, with version 2.00+, it might be necessary to replace the original answer cell codes (‘001’, ‘002’, ‘003’) with ‘00A1’, ‘00A2’ and ‘00A3’, like in MaLu’s case, but, once again, no joy.

I’ve checked everything (at least I think so!) a number of times now but I really can’t see where the problem lies. Although I now understand the function of the JavaScript code, I lack the IT knowledge necessary to see if something has been deleted/omitted/displaced etc.

Please could you have a quick look at my efforts to see where I’m going wrong? (the ‘Test’ survey is not activated; do you need me to activate it?)

Thanks a million in advance!

Regards,

StuTheQ (tenacious, if nothing else..!! :) )

PS If you’re wondering why my question IDs are Q1:143, Q2:158 and qHidden:153, it’s because I deleted Q2 and then created it again just before writing this post.
Last Edit: 3 years 1 week ago by StuTheQ.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.618 seconds