The CreatorCon Call for Content is officially open! Get started here.

How to restrict the selection of number of choices for a List Collector Variable

Aditya02
Tera Guru

I have a List Collector Variable, In this I want to restrict the selection of number of choices to two only. So, that user can able to select two options only. How to Perform this.

1 ACCEPTED SOLUTION

I can see OnChange

piyushsain_0-1706520215427.png

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

View solution in original post

13 REPLIES 13

piyushsain
Tera Guru

Hi @Aditya02 ,

Create onSubmit catalog client script

 

 

function onSubmit()

var values = g_form.getValue('variableName').toString().split(',');

if(values.length > 2){

alert('Please select only 2 choices');

return false;

}

}

 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

can we able to do anything , when user selecting of choices itself, instead of before submitting the form.

while selecting itself, he should not able select more than 2 choices. 

 

@Aditya02 

You can use onClick for it and restrict adding more than two

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

There is No such Onclick type, Only has these types:

  1. Onchange

  2. Onsubmit

  3. Onceledit

  4. Onload