unable to get property 'setAttribute' of undefined....

Please post all questions relating to Help & Manual 6 here!

Moderators: Alexander Halser, Tim Green

Post Reply
Maxine Dye
Posts: 16
Joined: Tue Apr 02, 2013 2:37 pm

unable to get property 'setAttribute' of undefined....

Unread post by Maxine Dye »

Hello,
I'm hoping someone can help with this issue which has just started happening in my .chm files...
On random pages, on opening a Script Error message displays. ' Unable to get property 'setAttribute' of undefined or null reference.'
On 1 page I was able to find an issue with what I think was a corrupt toggle setup, which I was able to fix.
I've now found there are several other pages with similar and rebuilding the toggles, compiling and checking the pages again is abit tedious.
Has anyone seen this issue before and is there a quicker way to resolve?

Hope someone can help!
regards
Maxine
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: unable to get property 'setAttribute' of undefined....

Unread post by Tim Green »

Hi Maxine,

If you look in the compiler report displayed after you publish your project you should see references to all the orphaned toggles found. These references include the link text of the orphaned toggle links, and you can then search for that text in the the affected topics and click on it. If it is a link, just right-click on it and select "Convert to plain text" and that will solve the problem.

It is a little more difficult if the orphaned toggle links are "ghost links", that exist but do not have any link text.

If you can't find the orphaned toggles they may not have captions at all, which makes it more difficult. It means that you accidentally managed to delete the caption of the toggle link without deleting the link (a single space character probably remained when this happened). This may have happened a while ago, because it is much more difficult to do this in the current version of HM.

To search for the orphaned toggles without captions you need to look directly in the XML editor. See this image for reference:
orphan_toggle_xml.png
Select the XML Source tag and locate the toggle starting place by pressing CTRL+F and searching for

Code: Select all

<toggle type="dropdown 
You only need to search for the first characters of this tag as shown above. You will see whether there is a caption because the highlighted CDATA block that contains the caption will be empty. In a valid toggle, the closing </toggle></para> tags of the toggle will be followed by another <para .. > tag enclosing a table in a <table..> tag. That will be missing in an orphaned toggle.

To delete the orphaned toggle once you have located it, select and delete the entire <para...><toggle..> ... </toggle></para> block in the XML editor.
You do not have the required permissions to view the files attached to this post.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Maxine Dye
Posts: 16
Joined: Tue Apr 02, 2013 2:37 pm

Re: unable to get property 'setAttribute' of undefined....

Unread post by Maxine Dye »

Hello Tim, thankyou for your detailed reply. Just to be clear about the compiler report is that the one that displays on the right of the main H&M window? Is there any other report as this one only lists topics with dead references but there is no mention of my corrupt Toggles and none of the topics listed are the topic pages this is occuring in...
regards
Maxine
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: unable to get property 'setAttribute' of undefined....

Unread post by Tim Green »

Hi Maxine,

Yes, the compiler report is the list of information displayed on the right (if you haven't undocked it into a separate window) when you publish. If you're not getting any references to orphaned toggles there, there must be some other problem. We need to have a look at a project to see what is going on here. Please mail me a small Help & Manual project showing the issue to support AT ec-software.com (replace the AT with @). We don't need the graphics initially, just the project itself in single-file .hmxz format. It's easiest if you send a compressed, single-file HMXZ project. If you're using uncompressed .hmxp for your daily work (and you should!), you can save a single-file .hmxz copy with Save As... in the File menu. Choose the "Help Project (single file storage)" format, (.HMXZ in the description text on the right). Then just delete all the unnecessary topics in the project copy before mailing.

Important: If you are using a skin please also send your .hmskin skin file.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Maxine Dye
Posts: 16
Joined: Tue Apr 02, 2013 2:37 pm

Re: unable to get property 'setAttribute' of undefined....

Unread post by Maxine Dye »

Hi Tim, I've taken a look and the cause is definitely what you have outlined below. it appears to be duplicating some of the xml - making the first reference empty (ie CData[]... following further along the line with the correct CData[title here]. It concerns me that the error is not flagging in the report and therefore I don't see it until Testing advise me. I was wondering if H&M has any settings controlling what's displayed in the compiler report?

regards
Maxine
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: unable to get property 'setAttribute' of undefined....

Unread post by Tim Green »

Hi Maxine,
it appears to be duplicating some of the xml - making the first reference empty (ie CData[]... following further along the line with the correct CData[title here].
Help & Manual can't and doesn't duplicate anything. If you're seeing this it would have been created by the author accidentally during an editing session -- for example by deleting the caption of a toggle without deleting the full toggle.

The compiler report may sometimes miss something like this, particularly if the caption is completely missing. However, that is not a problem once you have located it. To delete the orphaned toggle once you have located it, select and delete the entire <para...><toggle..> ... </toggle></para> block in the XML editor.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Maxine Dye
Posts: 16
Joined: Tue Apr 02, 2013 2:37 pm

Re: unable to get property 'setAttribute' of undefined....

Unread post by Maxine Dye »

Hi Tim, that would make sense from reviewing them!
Thankyou for your input, I've now resolved the issues on the pages throwing the error.

regards
Maxine
Post Reply