Welcome, Guest
Username: Password: Remember me

TOPIC: limiting a number choices a user may select within a survey

limiting a number choices a user may select within a survey 3 years 2 months ago #60942

  • Aasifdevos
  • Aasifdevos's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Good day

Could anyone please tell me if it is possible to limit/restrict a user to only select at most four out of fifteen individual questions??

Regards
Aasif
Last Edit: 3 years 2 months ago by Aasifdevos.
The administrator has disabled public write access.

Re: limiting a number choices a user may select within a survey 3 years 2 months ago #60945

  • lovepade
  • lovepade's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 93
  • Karma: 0
If you use the question type "multiple choice", you can set minimum and maximum number of choices under "advanced settings" - see: docs.limesurvey.org/Question+type+-+Mult...oice#Minimum_answers
The administrator has disabled public write access.

Re: limiting a number choices a user may select within a survey 3 years 2 months ago #60951

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
You may be able to use this workaround to display a random set of questions - docs.limesurvey.org/tiki-index.php?page=...Random_question_sets
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.
The administrator has disabled public write access.
The following user(s) said Thank You: Aasifdevos

Re: limiting a number choices a user may select within a survey 3 years 2 months ago #60970

  • Aasifdevos
  • Aasifdevos's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Hi Tony

I am not sure if i am saying the correct terminology.

Could i send you a link to my survey then you would be able to get a better understanding??

I would like to use this survey as an online election ballet.

I have +/- 9 questions within a question group.
Each question has a image of a candidate with a short description.

Each users should only be able to select four candidates at most.

Regards
Aasif
The administrator has disabled public write access.

Re: limiting a number choices a user may select within a survey 3 years 2 months ago #60973

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
I get the idea now. What question types are you using?

Send me a PM with the survey link.
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.
The administrator has disabled public write access.

Re: limiting a number choices a user may select within a survey 3 years 2 months ago #61029

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Okay, I see that you are using a series of multiple-options questions in a group, each with a single checkbox to select a candidate.

Why don't you put all candidates into one multiple-options question and use the "Maximum answers" setting?

If you need to have separate questions, the following script will limit the number of checked boxes allowed on a page.

Set up your survey to use JavaScript and place the following script in the source of one the questions. Modify the maxChecked variable (line 5) and the alert (line 6) as necessary.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var maxChecked = 4;
		var msg = 'You can only select '+maxChecked+' choices';
 
		$('input.checkbox').click(function(){
			if($('input.checkbox:checked').length > maxChecked) {
				alert (msg);
				$(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.
The administrator has disabled public write access.
The following user(s) said Thank You: Aasifdevos
Moderators: ITEd
Time to create page: 0.118 seconds
Donation Image