{"record":{"id":"780842334ff8687f","repo":"Semantic-Org/Semantic-UI","slug":"name-must-have-rulevalue-or-less-choices","errorCode":null,"errorMessage":"{name} must have {ruleValue} or less choices","messagePattern":"(.+?) must have (.+?) or less choices","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1279,"sourceCode":"    number               : '{name} must be set to a number',\n    is                   : '{name} must be \"{ruleValue}\"',\n    isExactly            : '{name} must be exactly \"{ruleValue}\"',\n    not                  : '{name} cannot be set to \"{ruleValue}\"',\n    notExactly           : '{name} cannot be set to exactly \"{ruleValue}\"',\n    contain              : '{name} must contain \"{ruleValue}\"',\n    containExactly       : '{name} must contain exactly \"{ruleValue}\"',\n    doesntContain        : '{name} cannot contain  \"{ruleValue}\"',\n    doesntContainExactly : '{name} cannot contain exactly \"{ruleValue}\"',\n    minLength            : '{name} must be at least {ruleValue} characters',\n    length               : '{name} must be at least {ruleValue} characters',\n    exactLength          : '{name} must be exactly {ruleValue} characters',\n    maxLength            : '{name} cannot be longer than {ruleValue} characters',\n    match                : '{name} must match {ruleValue} field',\n    different            : '{name} must have a different value than {ruleValue} field',\n    creditCard           : '{name} must be a valid credit card number',\n    minCount             : '{name} must have at least {ruleValue} choices',\n    exactCount           : '{name} must have exactly {ruleValue} choices',\n    maxCount             : '{name} must have {ruleValue} or less choices'\n  },\n\n  selector : {\n    checkbox   : 'input[type=\"checkbox\"], input[type=\"radio\"]',\n    clear      : '.clear',\n    field      : 'input, textarea, select',\n    group      : '.field',\n    input      : 'input',\n    message    : '.error.message',\n    prompt     : '.prompt.label',\n    radio      : 'input[type=\"radio\"]',\n    reset      : '.reset:not([type=\"reset\"])',\n    submit     : '.submit:not([type=\"submit\"])',\n    uiCheckbox : '.ui.checkbox',\n    uiDropdown : '.ui.dropdown'\n  },\n\n  className : {","sourceCodeStart":1261,"sourceCodeEnd":1297,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1261-L1297","documentation":"Semantic UI Form 'maxCount' rule message. The rule (form.js:1693) asserts the comma-split selection count is <= ruleValue. Fires for multi-select/checkbox-group fields when the user has selected more than the configured maximum.","triggerScenarios":"A field with rules:[{type:'maxCount[N]'}] whose comma-joined value has more than N entries; e.g. maxCount[3] but the user toggled 4 checkboxes.","commonSituations":"Limiting tag selection, role assignment, or file count; accidentally using maxCount on a free-text field; off-by-one between server-side and client-side limits.","solutions":["Reduce the selection so the count is <= maxCount.","Re-check that the field is a multi-select/checkbox group and not a single text input (use maxLength for character limits).","Align maxCount with the matching server-side limit to avoid submitting then being rejected."],"exampleFix":"// before\nrules: [{ type: 'maxCount[3]' }] // 4 selected\n// after\nrules: [{ type: 'maxCount[4]' }]","handlingStrategy":"validation","validationCode":"function underMaxCount(fieldId, max) {\n  return document.querySelectorAll('input[name=\"' + fieldId + '\"]:checked').length <= max;\n}\nif (!underMaxCount('perms', 5)) { /* warn before submit */ }","typeGuard":"function isMaxCountRule(rule) {\n  return typeof rule === 'object' && typeof rule.type === 'string' && /^maxCount\\[\\d+\\]$/.test(rule.type);\n}","tryCatchPattern":null,"preventionTips":["Use maxLength for character-based limits, maxCount only for selection counts.","Visually disable unchecked options once the limit is reached."],"tags":["form-validation","semantic-ui","rule-maxcount","checkbox-group"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}