Semantic-Org/Semantic-UI · warning
{name} must have {ruleValue} or less choices
Error message
{name} must have {ruleValue} or less choices What it means
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.
Source
Thrown at src/definitions/behaviors/form.js:1279
number : '{name} must be set to a number',
is : '{name} must be "{ruleValue}"',
isExactly : '{name} must be exactly "{ruleValue}"',
not : '{name} cannot be set to "{ruleValue}"',
notExactly : '{name} cannot be set to exactly "{ruleValue}"',
contain : '{name} must contain "{ruleValue}"',
containExactly : '{name} must contain exactly "{ruleValue}"',
doesntContain : '{name} cannot contain "{ruleValue}"',
doesntContainExactly : '{name} cannot contain exactly "{ruleValue}"',
minLength : '{name} must be at least {ruleValue} characters',
length : '{name} must be at least {ruleValue} characters',
exactLength : '{name} must be exactly {ruleValue} characters',
maxLength : '{name} cannot be longer than {ruleValue} characters',
match : '{name} must match {ruleValue} field',
different : '{name} must have a different value than {ruleValue} field',
creditCard : '{name} must be a valid credit card number',
minCount : '{name} must have at least {ruleValue} choices',
exactCount : '{name} must have exactly {ruleValue} choices',
maxCount : '{name} must have {ruleValue} or less choices'
},
selector : {
checkbox : 'input[type="checkbox"], input[type="radio"]',
clear : '.clear',
field : 'input, textarea, select',
group : '.field',
input : 'input',
message : '.error.message',
prompt : '.prompt.label',
radio : 'input[type="radio"]',
reset : '.reset:not([type="reset"])',
submit : '.submit:not([type="submit"])',
uiCheckbox : '.ui.checkbox',
uiDropdown : '.ui.dropdown'
},
className : {View on GitHub (pinned to 597843ab84)
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.
Example fix
// before
rules: [{ type: 'maxCount[3]' }] // 4 selected
// after
rules: [{ type: 'maxCount[4]' }] Defensive patterns
Strategy: validation
Validate before calling
function underMaxCount(fieldId, max) {
return document.querySelectorAll('input[name="' + fieldId + '"]:checked').length <= max;
}
if (!underMaxCount('perms', 5)) { /* warn before submit */ } Type guard
function isMaxCountRule(rule) {
return typeof rule === 'object' && typeof rule.type === 'string' && /^maxCount\[\d+\]$/.test(rule.type);
} Prevention
- Use maxLength for character-based limits, maxCount only for selection counts.
- Visually disable unchecked options once the limit is reached.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {name} must have at least {ruleValue} choices
- {name} must have exactly {ruleValue} choices
- {name} must be a valid url
- {name} is not formatted correctly
- {name} must be an integer
AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13).
Data as JSON: /api/errors/780842334ff8687f.
Report an issue: GitHub.