{"record":{"id":"7ed75da6934b79b2","repo":"octobercms/october","slug":"trigger-condition-is-not-specified","errorCode":null,"errorMessage":"Trigger condition is not specified.","messagePattern":"Trigger condition is not specified\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/system/assets/toolbox/controls/input-trigger/input-trigger-control.js","lineNumber":13,"sourceCode":"/*\n * The trigger API\n */\nimport { ControlBase, Events } from 'larajax';\n\nconst $ = window.jQuery;\n\nvar windowResizeTimer;\n\nexport default class InputTriggerControl extends ControlBase {\n    init() {\n        if (this.config.triggerCondition === false) {\n            throw new Error('Trigger condition is not specified.');\n        }\n\n        if (this.config.trigger === false) {\n            throw new Error('Trigger selector is not specified.');\n        }\n\n        if (this.config.triggerAction === false) {\n            throw new Error('Trigger action is not specified.');\n        }\n\n        this.triggerSelector = this.config.trigger;\n        this.triggerAction = this.config.triggerAction;\n        this.triggerCondition = this.config.triggerCondition;\n\n        if (this.config.triggerCondition.indexOf('value') == 0) {\n            var match = this.config.triggerCondition.match(/\\[([^\\]]*)\\]/g);\n            this.triggerCondition = 'value';\n            this.triggerConditionValue = match ? match.map(m => m.slice(1, -1)) : [\"\"];","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/assets/toolbox/controls/input-trigger/input-trigger-control.js#L1-L31","documentation":"InputTriggerControl (the 'input-trigger' toolbox control) implements the trigger API: show/hide/enable/disable/empty an element based on another input's state. init() requires three data attributes — data-trigger-condition, data-trigger, data-trigger-action — and this one fires when triggerCondition is absent (config defaults to false). Valid conditions are 'checked', 'unchecked', or 'value[expectedValue]' (wildcards allowed inside the brackets).","triggerScenarios":"Markup like <div data-control=\"input-trigger\" data-trigger=\"[name=type]\" data-trigger-action=\"show\"> — the condition attribute is missing; partial templates that conditionally emit some of the three attributes; typos in the attribute name (data-trigger-conditions) leaving config.triggerCondition false.","commonSituations":"Building dependent form fields in CMS partials; copying an example from docs but trimming the condition attribute; dynamic form generation (form builder YAML → markup) where the condition mapping was not supplied.","solutions":["Add data-trigger-condition with a valid value: 'checked', 'unchecked', or 'value[something]' (e.g. data-trigger-condition=\"value[standard]\", wildcard value[*] allowed).","Verify all three required attributes are present on the same element (condition, trigger, action) — the other two throw sibling errors.","If the dependency behavior is not wanted, remove data-control=\"input-trigger\" from the element."],"exampleFix":"<!-- before -->\n<div data-control=\"input-trigger\" data-trigger=\"[name=is_company]\" data-trigger-action=\"show\">...</div>\n\n<!-- after -->\n<div data-control=\"input-trigger\" data-trigger=\"[name=is_company]\" data-trigger-condition=\"checked\" data-trigger-action=\"show\">...</div>","handlingStrategy":"validation","validationCode":"// Validate the trigger triple before the control initializes\nfunction triggerAttrsComplete(el) {\n    return ['data-trigger-condition', 'data-trigger', 'data-trigger-action']\n        .every(function (name) { return el.hasAttribute(name); });\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Emit the three trigger attributes together from one partial/template helper so one is never dropped.","Constrain data-trigger-condition to checked|unchecked|value[...] in your form-builder validation.","Lint rendered markup for input-trigger elements missing any of the three attributes."],"tags":["frontend","toolbox-controls","input-trigger","missing-attribute","form-ux"],"backgroundTag":"missing-required-attribute","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}