Welcome, Guest
Username: Password: Remember me

TOPIC: Hide answer option - Calculate value is not defined

Hide answer option - Calculate value is not defined 3 years 2 months ago #64098

  • asonimie
  • asonimie's Avatar
I have an active survey with some data on it already. I want to hide two answer options in an array quesiton. I keep on getting an error of calculatevalueSIDXGIDXQID is not defined. Not sure what's causing that error.

Here's an example of the survey

fpitesters.limeask.com/index.php?sid=69548&newtest=Y&lang=en

I'm using the following code:

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

hideRows(42739);

function hideRows(q1ID) {

// Loop through all Q1 sub-questions
$('#question'+q1ID+' li').each(function(i) {

if($('label', this).text() == 'No answer') {
$(this).hide();
$('input.text', this).val(0);
}

});

calculateValue69548X1356X42739(1); // NOTE: this needs to use local survey, group and q2 question IDs
}
});

</script>
The administrator has disabled public write access.

Re: Hide answer option - Calculate value is not defined 3 years 2 months ago #64103

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4210
  • Thank you received: 792
  • Karma: 360
That script is for a different question type.

I assume you want to hide the "No answer" rows.

Try this:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		hideRows(42739);
 
		function hideRows(q1ID) {
 
			// Loop through all Q1 sub-questions
			$('#question'+q1ID+' table.question tbody').each(function(i) {
 
				if($('td.answertext', this).text() == 'No answer') {
					$(this).hide();
					$('input.radio', this).attr('checked', false);
				}
 
			});
		}
	});
 
</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.
Last Edit: 3 years 2 months ago by tpartner.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.113 seconds
Donation Image