Announcement

Collapse
No announcement yet.

Apostrophes and Javascript errors about missing semi-colons (red herrings)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Apostrophes and Javascript errors about missing semi-colons (red herrings)

    I have just spent the best part of the last 3 hours trying to figure out why I got a script error (but only in IE, not Firefox) that said there was a missing ";" or semi-colon in the code. I am not familiar with javascript myself so to find the cause of the problem I had employ a process of elimination to isolate that it was NETQUOTEVAR:PRODUCTNAME in the Actinic recommended "email a friend" code that was causing the problem. Deleting it certainly got rid of the problem, however I just could not figure out why. For much of the time I was focusing on the colon within the actinic variable but I came to the conclusion this must be a red herring. I scoured Google results for anything containing reference to colon, semi-colon and javascript error but nothing came through. Eventually when I realised I had been scratching around in a blind alley, the manhole cover sized penny dropped from the great blue sky. I realised that it was the apostrophe I had used in some product names that was causing the issue. Replacing these with single quotation marks (‘ and ’) as appropriate fixed it. The error about the missing semi-colon was generated because the apostrophe in the product name caused an early termination of the script, which in turn meant that the ; was not automatically created at the end of the script line as I have learnt is the case.
    Anyway, maybe it was me, but I was amazed to find nothing on this issue in either the knowledge base or the community. I would not want anyone else who shares my limited knowledge of Javascript to fall into the same trap and waste countless hours trying to figure out, hence the post. Hopefully I've put enough keywords in the message to enable an easy find.

    #2
    I'm sure that your post will help others in the future and they'll be glad you posted it.

    There are quite a number of past posts related to single quotes, a forum search for 'single quote' will uncover some of them.

    Comment


      #3
      I wrote that code and it originally didn't include the product name. When asked to add it, I said on http://community.actinic.com/showthread.php?t=1639 post #13
      I also looked at getting the product name to be included on the e-mail but since quotes are legal within such names some products would break the JavaScript.
      It looks like that warning got lost in wherever you got the patch from.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment

      Working...
      X