Issue
TGML Graphic Alert: TypeError: Cannot call method "getAttribute" of null (cmd#52)
TGML Graphic Alert: TypeError: Cannot call method "setAttribute" of null (cmd#52)
Environment
Vista 5
TGML Graphic
Cause
A Javascript tag in the TGML file has attempted to perform an action on a null pointer. Oftentimes this is due to a component being deleted or renamed without realizing that a script elsewhere in the graphic was pointing to it.
Resolution
-
Determine which script tag is generating the error.
- When did the error occur? When the page loaded? When a value changed? When the user clicked? Did it happen once or multiple times? These questions can help you narrow down which script has thrown the error.
- Save the graphic under a different name. Delete portions of the graphic until the error clears. The component that was removed holds the offending script.
- The cmd# syntax is indicating which line of the script has the error. Launch the script editor by clicking the "..." button next to the script Content attribute. In this example, go to line 52 of the code.
- The text in quotes tells which method was being used. In this example "getAttribute." Investigate what is in the parameters of the getAttribute() function. Verify that object exists as defined.
- Edit the script to point to a valid object, rename or restore any deleted object.