cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

How can restrict the number of multi choice column?

Hi everyone,

 

I need to find the solution to restrict the number of items in choice colum.

Here me scenario:

1- We have a list of 50 community members

2- People can choice just 15 number of those 50 members (unique one)

so I need the choice column that allow user to select 15 out of 50 memebrs!

 

How can implement this?

I am looking forward to hearing your answer

Labels: (2)
0 Kudos
Reply
5 Replies
Highlighted
Not applicable

Re: How can restrict the number of multi choice column?

Hi,

 

You have to use Custom Validation for this.

 

1. Double click on your choice control, and from Advanced section, set Store Client ID in JavaScript variable to Yes, and set the Client ID JavaScript variable name to MemberSelection. Change the Validation -> Use custom validation to Yes, and set Custom validation function to ValidateMemberSelection.

2. From ribbon, go to Settings -> Custom JavaScript section and paste this in:

 

function ValidateMemberSelection(args, validator) {     var selectedMembers = NWF$('#' + MemberSelection).find(":checked");      validator.IsValid = selectedMembers.length <= 15; }

 

What this function does is whenever user save the form, it will run this function and check the checked option, you can change the 15 to whatever number you like, this function will invalid if it's more than 15 option selected.

 

Hope it help.

Reply
Highlighted
Not applicable

Re: How can restrict the number of multi choice column?

Dear Stephen,

Thanks for your answer, It's work but with a little confusion! I mean our users can choose  15 or more but when he tries to view the item again if its more than 15 or 15 just 4 of them has selected!

I need to delete those extra items or may say the user "you must not choose more than 15!"

Thank you

0 Kudos
Reply
Highlighted
Not applicable

Re: How can restrict the number of multi choice column?

I'm confused now

Can you list down the steps for the scenario, like what user see in the form, and how would they key in the data (select the options), maybe can post a screenshot of the form, so we can have better understanding (remember to remove sensitive data).

0 Kudos
Reply
Highlighted
Not applicable

Re: How can restrict the number of multi choice column?

Hi

I am so sorry I made a mistake

Your selution its work.

0 Kudos
Reply
Highlighted
Not applicable

Re: How can restrict the number of multi choice column?

Hi, Fati Heidari​, If you have a solution, please click the "correct answer" button. It's helpful for other members of the community looking for correct answers. Thank you!

0 Kudos
Reply