{"record":{"id":"1a69a283eb0abe64","repo":"parallax/jsPDF","slug":"invalid-value-value-for-attribute-ft-supplied","errorCode":null,"errorMessage":"Invalid value \"{value}\" for attribute FT supplied.","messagePattern":"Invalid value \"(.+?)\" for attribute FT supplied\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/modules/acroform.js","lineNumber":1197,"sourceCode":"  });\n\n  var _FT = \"\";\n  Object.defineProperty(this, \"FT\", {\n    enumerable: true,\n    configurable: false,\n    get: function() {\n      return _FT;\n    },\n    set: function(value) {\n      switch (value) {\n        case \"/Btn\":\n        case \"/Tx\":\n        case \"/Ch\":\n        case \"/Sig\":\n          _FT = value;\n          break;\n        default:\n          throw new Error(\n            'Invalid value \"' + value + '\" for attribute FT supplied.'\n          );\n      }\n    }\n  });\n\n  var _T = null;\n\n  Object.defineProperty(this, \"T\", {\n    enumerable: true,\n    configurable: false,\n    get: function() {\n      if (!_T || _T.length < 1) {\n        // In case of a Child from a Radio´Group, you don't need a FieldName\n        if (this instanceof AcroFormChildClass) {\n          return undefined;\n        }\n        _T = \"FieldObject\" + AcroFormField.FieldNum++;","sourceCodeStart":1179,"sourceCodeEnd":1215,"githubUrl":"https://github.com/parallax/jsPDF/blob/a3930ce03a585a26b2c76d12a0f413ce96f6d1a3/src/modules/acroform.js#L1179-L1215","documentation":"Thrown by the AcroFormField.FT setter when value is not one of the four valid PDF field types: '/Btn' (button), '/Tx' (text), '/Ch' (choice), '/Sig' (signature). FT is the required Field Type entry (PDF spec). The setter uses a strict switch and rejects anything else, including common mistakes like 'text', 'TextField', or missing the leading slash.","triggerScenarios":"Setting field.FT to a value without the leading slash (e.g. 'Tx'), a human-readable type name ('text','button'), or any unsupported type.","commonSituations":"Constructing a custom field and forgetting the '/'; copying a type from documentation that omitted the slash; assigning the wrong constant.","solutions":["Use one of the four exact PDF type strings with the leading slash: '/Btn', '/Tx', '/Ch', '/Sig'.","Prefer the concrete field classes provided by the acroform module (Button, TextField, ChoiceField, etc.) which set FT correctly.","Whitelist the value before assignment."],"exampleFix":"// before\nfield.FT = 'text'; // throws\n\n// after\nfield.FT = '/Tx';\n// or use the typed constructor\nvar tf = new doc.AcroFormTextField();","handlingStrategy":"validation","validationCode":"var VALID_FT = ['/Btn', '/Tx', '/Ch', '/Sig'];\nif (VALID_FT.indexOf(value) === -1) {\n  throw new Error('FT must be one of ' + VALID_FT.join(', ') + ', got ' + value);\n}\nfield.FT = value;","typeGuard":"function isValidFT(v) {\n  return ['/Btn','/Tx','/Ch','/Sig'].indexOf(v) !== -1;\n}","tryCatchPattern":"try {\n  field.FT = value;\n} catch (e) {\n  if (/attribute FT supplied/.test(e.message)) {\n    throw new Error(\"FT must be '/Btn', '/Tx', '/Ch', or '/Sig' (note the leading slash)\");\n  }\n  throw e;\n}","preventionTips":["Always include the leading slash: '/Tx', '/Btn', '/Ch', '/Sig'.","Use the typed field constructors (AcroFormTextField, etc.) which set FT correctly.","Whitelist the value before assignment."],"tags":["acroform","field-validation","pdf-types"],"backgroundTag":null,"analyzedSha":"a3930ce03a585a26b2c76d12a0f413ce96f6d1a3","analyzedAt":"2026-08-13T05:33:39.648Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}