{"record":{"id":"310af0204d8ab817","repo":"Semantic-Org/Semantic-UI","slug":"name-must-have-at-least-rulevalue-choices","errorCode":null,"errorMessage":"{name} must have at least {ruleValue} choices","messagePattern":"(.+?) must have at least (.+?) choices","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1277,"sourceCode":"    integer              : '{name} must be an integer',\n    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  },","sourceCodeStart":1259,"sourceCodeEnd":1295,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1259-L1295","documentation":"A Semantic UI Form validation message emitted by the 'minCount' rule. The rule (form.js:1673) splits the field value on commas and asserts the resulting item count is >= ruleValue; otherwise the bound prompt/error message replaces {name} with the field label and {ruleValue} with the configured minimum. It is the multi-select/checkbox-group analogue of 'minLength' for character counts.","triggerScenarios":"Defined on a checkbox group or multi-value field whose value is a comma-joined list (e.g. \"on change of a .ui.checkbox group\"). Fires when the count of selected items is strictly less than the minCount declared in that field's rules array (rules: [{type:'minCount[3]'}]).","commonSituations":"Asking the user to pick at least N tags/categories/permissions, but submitting with fewer; mis-typing the rule as 'minLength' (counts characters) instead of 'minCount'; setting minCount on a plain text input whose value has no commas so the count is always 1.","solutions":["Increase the number of selected items to satisfy the displayed minimum, or lower the minCount value in the field rules.","Confirm the field is actually a multi-select/checkbox group; for a single text input use 'minLength' rather than 'minCount'.","Check that the field identifier resolves to the checkbox group and that values join into a comma-separated string as the rule expects."],"exampleFix":"// before\nfields: { roles: { rules: [{ type: 'minCount[3]', prompt: '...' }] } } // user only picks 2\n// after - either require fewer or provide more selections\nfields: { roles: { rules: [{ type: 'minCount[2]' }] } }","handlingStrategy":"validation","validationCode":"// Before calling $('.ui.form').form('validate form'), check selection counts\nfunction selectionCount(fieldId) {\n  var checked = document.querySelectorAll('input[name=\"' + fieldId + '\"]:checked');\n  return checked.length;\n}\nvar minRequired = 3;\nif (selectionCount('roles') < minRequired) {\n  // show inline guidance instead of relying on the rule firing\n}","typeGuard":"function isValidMinCountConfig(field) {\n  return field && Array.isArray(field.rules) && field.rules.some(function(r){\n    return typeof r.type === 'string' && /^minCount\\[\\d+\\]$/.test(r.type);\n  });\n}","tryCatchPattern":null,"preventionTips":["Mirror client-side count limits with the same server-side validation.","Use minCount only on checkbox/multi-select groups; never on single-value text inputs.","Test the validation flow with zero, partial, and full selections."],"tags":["form-validation","semantic-ui","rule-mincount","checkbox-group"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}