{"record":{"id":"9665170fa3dde913","repo":"Semantic-Org/Semantic-UI","slug":"name-must-be-checked","errorCode":null,"errorMessage":"{name} must be checked","messagePattern":"(.+?) must be checked","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1255,"sourceCode":"    htmlID  : /^[a-zA-Z][\\w:.-]*$/g,\n    bracket : /\\[(.*)\\]/i,\n    decimal : /^\\d+\\.?\\d*$/,\n    email   : /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,\n    escape  : /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,\n    flags   : /^\\/(.*)\\/(.*)?/,\n    integer : /^\\-?\\d+$/,\n    number  : /^\\-?\\d*(\\.\\d+)?$/,\n    url     : /(https?:\\/\\/(?:www\\.|(?!www))[^\\s\\.]+\\.[^\\s]{2,}|www\\.[^\\s]+\\.[^\\s]{2,})/i\n  },\n\n  text: {\n    unspecifiedRule  : 'Please enter a valid value',\n    unspecifiedField : 'This field'\n  },\n\n  prompt: {\n    empty                : '{name} must have a value',\n    checked              : '{name} must be checked',\n    email                : '{name} must be a valid e-mail',\n    url                  : '{name} must be a valid url',\n    regExp               : '{name} is not formatted correctly',\n    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',","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1237-L1273","documentation":"This is a validation prompt used by Semantic UI's Form module. It is displayed when a checkbox or radio input with the 'checked' validation rule fails because the element is not in a checked state. The prompt is retrieved via module.get.prompt() (form.js:440-442) with {name} replaced by the field's label. The 'checked' rule function (form.js:1342-1343) checks $(this).filter(':checked').length > 0.","triggerScenarios":"A checkbox or radio field is configured with rules: [{ type: 'checked' }] and the user submits the form without checking it. The validate.rule() function calls the 'checked' rule which filters the jQuery element set for :checked; if none are checked, validation fails and this prompt is shown.","commonSituations":"Terms-of-service or consent checkboxes left unchecked. Required radio button groups (e.g., gender, payment method) with no selection. Checkbox arrays where at least one must be checked. Dynamically rendered checkbox lists where the user misses one. Checkbox widgets wrapped by Semantic UI's checkbox module where the underlying input state doesn't sync.","solutions":["Ensure the user checks the required checkbox/radio (this prompt IS the solution for unchecked required fields).","Customize the prompt: settings.prompt.checked = 'Please accept the {name} to continue'.","If using Semantic UI's checkbox module, ensure the underlying input is properly synced via $('.ui.checkbox').checkbox().","If the field is optional, remove the 'checked' rule."],"exampleFix":"// before\n$('.ui.form').form({\n  agree: { rules: [{ type: 'checked', prompt: '{name} must be checked' }] }\n  // generic prompt\n});\n\n// after\n$('.ui.form').form({\n  agree: {\n    identifier: 'agree',\n    rules: [{ type: 'checked', prompt: 'Please accept the Terms of Service' }]\n  }\n});","handlingStrategy":"validation","validationCode":"// Pre-validate checkbox/radio state before form submission\nfunction validateChecked($form) {\n  var valid = true;\n  $form.find('input[data-validate=\"checked\"]').each(function() {\n    if (!$(this).is(':checked')) {\n      valid = false;\n      console.warn('Checkbox not checked:', $(this).attr('name'));\n    }\n  });\n  return valid;\n}","typeGuard":"// Check if a checkbox or radio is checked\nfunction isChecked($field) {\n  return $field.is(':checked');\n}","tryCatchPattern":null,"preventionTips":["Ensure Semantic UI's checkbox module is properly synced with the underlying input.","Use clear, specific prompt messages for required checkboxes.","Consider using the 'exactChecked' or 'different' rules for more complex checkbox validation."],"tags":["form","validation","checkbox","radio","prompt","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}