Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Browsing responses

Aw: Browsing responses 4 years 9 months ago #74535

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6570
  • Thank you received: 1477
  • Karma: 579
Can i somehow list survey id's in the code that tpartner made before so i get the same action to other surveys aswell?
You can wrap the code in a function and then call it with the survey IDs followed by the columns to hide (all comma-separated).

The following example will hide two columns for surveys 13829 and 12269 and hide 4 columns for survey 66653.
$(document).ready(function(){
 
	hideColumns(13829,3,5);
	hideColumns(12269,3,5);
	hideColumns(66653,3,5,6,9);
 
	function hideColumns() {
 
		var sID = arguments[0];
 
		if($('input[name="sid"]').attr('value') == sID) {
 
			// Add some column-specific classes
			$('.browsetable tr').each(function(i, el){
				$('> *', this).each(function(i, el){ 
					$(el).addClass('col-'+(i+1));
				});
			});
 
			// Create an array of columns to hide
			var hiddenColumns = new Array();
			$(arguments).each(function(i, arg){
				if(i > 0) {
					hiddenColumns.push(arg);
				}
			});
 
			// Loop through the hiddenColumns and hide them
			$(hiddenColumns).each(function(i){ 
				$('.col-'+this+'').hide();
			});
		}
	}
 
});
Cheers,
Tony Partner

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

Browsing responses 4 years 9 months ago #74701

  • tave
  • tave's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Tpartner that is real magic thank you very much=) That works like a charm.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.454 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form