{"record":{"id":"70ae57c0aef9cf04","repo":"sveltejs/kit","slug":"type-inputs-must-have-a-value","errorCode":null,"errorMessage":"`${type}` inputs must have a value","messagePattern":"`(.+?)` inputs must have a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/form-utils.js","lineNumber":817,"sourceCode":"\t\t\t\t/** @type {Record<string, any>} */\n\t\t\t\tconst base_props = {\n\t\t\t\t\tname: type_prefix + key + (is_array ? '[]' : '') + '/' + context.form_id,\n\t\t\t\t\tget 'aria-invalid'() {\n\t\t\t\t\t\tconst issues = context.get_issues();\n\t\t\t\t\t\treturn key in issues ? 'true' : undefined;\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// Add type attribute only for non-text inputs and non-select elements\n\t\t\t\tif (type !== 'text' && type !== 'select' && type !== 'select multiple') {\n\t\t\t\t\tbase_props.type = type === 'file multiple' ? 'file' : type;\n\t\t\t\t}\n\n\t\t\t\t// Handle submit and hidden inputs\n\t\t\t\tif (type === 'submit' || type === 'hidden') {\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\tif (input_value === null || input_value === undefined) {\n\t\t\t\t\t\t\tthrow new Error(`\\`${type}\\` inputs must have a value`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn add_props(base_props, {\n\t\t\t\t\t\tvalue: typeof input_value === 'boolean' ? (input_value ? 'on' : 'off') : input_value\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Handle select inputs\n\t\t\t\tif (type === 'select' || type === 'select multiple') {\n\t\t\t\t\treturn add_props(base_props, {\n\t\t\t\t\t\tmultiple: is_array,\n\t\t\t\t\t\tvalue: () => {\n\t\t\t\t\t\t\tconst value = read(input_value);\n\t\t\t\t\t\t\t// copied, so the state array can't be edited through the props\n\t\t\t\t\t\t\treturn Array.isArray(value) ? [...value] : value;\n\t\t\t\t\t\t}\n\t\t\t\t\t});","sourceCodeStart":799,"sourceCodeEnd":835,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/form-utils.js#L799-L835","documentation":"Dev-time validation in the form element prop builder: for typed inputs like checkbox/radio (and other non-text inputs) a value attribute is mandatory so the form can serialize the field and match it against submitted data. This fires when such an input is created through the remote form component without a value option.","triggerScenarios":"Thrown at packages/kit/src/runtime/form-utils.js:817 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a value for the input, e.g. field('checkbox', 'option-a', { value: 'option-a' })","Omit submit/hidden types that legitimately have no value, or supply a default value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}