How to limit the number of checkboxes in a column with 60 names
Asked by bunnykid:

I am using Confluence server.

How do i create a table to show 60 names and only allow 30 of these people to select the checkboxes for "Free on date 1" while there's no limit to Free on date 2?

Please show me step by step if possible, i was using Task list checkbox and confiform field definition and confiform rules for field definition but none of them works.

Also i just want to allow checkbox to be selected, i don't want each user to click save button.

example:

Table1

1. name Free on date 1 (Y) Free on date 2 (Y)

2. name Free on date 1 (Y) Free on date 2 (Y)

Table2

1. name Free on date 3 (Y) Free on date 4 (Y)

2. name Free on date 3 (Y) Free on date 4 (Y)

Many thanks, appreciate your reply soonest.


Answers:
author: bunnykid
body: How do i set the condition to limit same userid allow 1 entry and this checkbox can only be submitted up to 30 times by different userid?

I want to put 60 checkboxes, each user submit only 1 time. In total only up to 30 user can submit option A when they visit the page to register.

This is to register a workshop up to 30 pax. If you have better idea, can advise how to set this up.

Condition:

chk1:\*\[entry._user\]\* AND chk1.asCount:\>1 AND chk1:A.asCount:\>30

Field name: chk1

Field label: chk1

checkboxgroup

A. Free on date 1

B. Free on date 1

comments: author: Alex Medved _ConfiForms_
body: **2 validation rules (against dataset)** with conditions as follows

To check only one entry per user

```
createdBy:[entry._user] AND _count:>1
```

To check

```
chck1.label:Free on date 1 AND _count:>30
```

Alex


author: bunnykid
body: Department Rep Attendance

A John 1) Date1 2) Date2 Register button

B John

C John

B Sandy 1) Date1 2) Date2 Register button

C Andrea 1) Date1 2) Date2 Register button

I try to use the same Confiform Field Definition but it does not allow duplicate. How can i setup for Attendance column to allow option 1) and 2) to allow registration?


author: bunnykid
body: i figure i can setup a register and display using

Confiform tableview and confiform field.

I can set Attendance option as radio button. But i can't limit 1) and 2) option to add up to 30 registration only.

i want to add Date1, Date2, Date3, Date4

```
chk1.label:Date1 AND chk1.label:Date2 AND _count:>30
```

I wonder any way for me to display the result showing John and the 3 department A,B,C as static label.

Also Once they have click register, can user change the entry? But limit to 1 user per entry.

I can add confiform field: createdBy.fullName to display John. But not the list of departments.


author: bunnykid
body: thanks..1 user total 1 submission works above.

any idea I can fix this first:

```
chk1.label:Date1 AND chk1.label:Date2 AND _count:>30
```

Field name: chk1

Field label: chk1

checkboxgroup or radio button is ok.

ID Label

A. Free on date 1

B. Free on date 2

C. Free on date 3

D. Free on date 4

\*A+B option should not exceed 30 entries in total.

C\&D option to be selected with no limit to how many entries in total with 1 entry per userid.


author: bunnykid
body: i do not have Confluence Storage Format, HTML Include, or Confluence Content Formatting macros.

I have code block, but I can't get javascript to work to limit the checkbox from being selected.

    var limit = 30;var checkboxes = document.querySelectorAll('.task-list-item-checkbox');for (var i = 0; i < checkboxes.length; i++) {  checkboxes[i].addEventListener('change', function() {    var checkedCount = document.querySelectorAll('.task-list-item-checkbox:checked').length;    if (checkedCount > limit) {      this.checked = false;      alert('You can only select up to ' + limit + ' checkboxes.');    }  });}

I tried to limit task list to 30 checked boxes with above code, but not sure how and where to apply it.

comments: author: Alex Medved _ConfiForms_
body: Not sure I can help with this JavaScript and it is absolutely unnecessary in ConfiForms

Add a validation rule <https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validationrule>

And set the condition to be something like

```
mycheckboxfield.label:Free on date 1 AND _count:>30
```

Set the "message to show" parameter and that's it

Alex


author: bunnykid
body: ++**confiform field definition**++

Field name: chk1

Field label: chk1

checkboxgroup

1. Free on date 1

2. Free on date 1

++**confiform rules for field definition**++

Field name: chk1

Condition:

```
chk1.label:Free on date 1 AND _count:>1
```

Action to execute: Validation rule

Message to show: Select 1 only

I can't limit the checkbox to select 1 only for "Free on date 1"


author: Alex Medved _ConfiForms_
body: Sorry, it should be "Validation rule on dataset" of course, as you want to check ALL the existing records + the one that's about to be added


author: Alex Medved _ConfiForms_
body: Hi [@bunnykid](/t5/user/viewprofilepage/user-id/5367260) and welcome to this community

This is probably the same question as being asked before. Have a look - <https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Confiforms-Limit-the-number-of-times-a-dropdown-can-be-selected/qaq-p/2418864>

Alex

comments: author: bunnykid
body: i tried using condition, it does not work. I don't want to have a button like Save for user to click.

```
yourcheckboxgroupfieldname.asCount:>2
```

User should click on check box only. Form should stop user from selecting checkbox once it reach 30 checks.


author: Alex Medved _ConfiForms_
body: This checks if a user selected more than 2 from the checkbox group


author: bunnykid
body: Able to provide any steps to specifically setup this? specific macro and how to trigger this :)


Tags: confiforms

confluence-server

server