Extend PMD 'Unknown Variable' Error When Clearing a Widget Value With Double Quotes
What it means
An onChange script tried to clear a text widget using double-quoted empty strings (widget.value = "") or setValue(null). The AMD/PMD expression language only recognizes single-quoted string literals, so a double-quoted empty string is not parsed as an empty string value, and the runtime reports the widget reference itself as an unknown variable instead of a quoting problem.
Troubleshooting
- Confirm the failing line is trying to assign or clear a widget value, then check which quote character is used around the literal.
- Replace any double-quoted string literal in the expression with single quotes, AMD/PMD expressions only treat single-quoted text as string literals.
- If clearing the field, use widgetName.setValue('') or widgetName.value = '' rather than null or a double-quoted empty string.
- Re-test the onChange handler after the change, the 'Unknown Variable' message clears once the literal is recognized correctly.
Change the double-quoted empty string or null assignment to a single-quoted empty string: widgetName.setValue('') or widgetName.value = ''.
Standardize on single quotes for all string literals in AMD/PMD expressions across a project (some teams add this to a code review checklist), since double quotes silently fail to parse as literals rather than throwing an obvious syntax error.