{"record":{"id":"f7215d2e8f2fa253","repo":"Semantic-Org/Semantic-UI","slug":"name-must-have-exactly-rulevalue-choices","errorCode":null,"errorMessage":"{name} must have exactly {ruleValue} choices","messagePattern":"(.+?) must have exactly (.+?) choices","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1278,"sourceCode":"    decimal              : '{name} must be a decimal number',\n    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","sourceCodeStart":1260,"sourceCodeEnd":1296,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1260-L1296","documentation":"Semantic UI Form 'exactCount' rule message. The rule function (form.js:1683) requires the comma-split item count to equal ruleValue exactly; otherwise this prompt is shown with {name} and {ruleValue} interpolated. Special-cases 0 (requires no value) and 1 (requires any non-empty value).","triggerScenarios":"Declared on a checkbox/multi-value field via rules:[{type:'exactCount[N]'}] and the number of comma-separated selected items differs from N (e.g. user picks 2 when exactCount is 3, or 4 when it is 3).","commonSituations":"Pick-exactly-N UX (e.g. choose 3 priorities), bulk-edit flows where the count must match, or accidental reuse of exactCount when minCount/maxCount was intended.","solutions":["Adjust the selection count up or down so it equals exactCount exactly.","If a range is acceptable, switch to minCount/maxCount instead of exactCount.","Verify exactCount isn't paired with single-value text inputs - the count is comma-delimited, not character length."],"exampleFix":"// before\nrules: [{ type: 'exactCount[3]' }] // user picked 2\n// after\nrules: [{ type: 'minCount[2]' }, { type: 'maxCount[3]' }]","handlingStrategy":"validation","validationCode":"function meetsExactCount(fieldId, n) {\n  return document.querySelectorAll('input[name=\"' + fieldId + '\"]:checked').length === n;\n}\nif (!meetsExactCount('tags', 3)) { /* guide the user before submit */ }","typeGuard":"function isExactCountRule(rule) {\n  return typeof rule === 'object' && typeof rule.type === 'string' && /^exactCount\\[\\d+\\]$/.test(rule.type);\n}","tryCatchPattern":null,"preventionTips":["Prefer minCount+maxCount when an exact count is not strictly required.","Disable the submit button until the exact count is met.","Surface the expected count clearly to users."],"tags":["form-validation","semantic-ui","rule-exactcount","checkbox-group"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}