5 Replies Latest reply on Aug 15, 2006 1:22 PM by wordguy

    Sending an E-mail message from a Webhelp topic using JavaScript

      I'm using a JavaScript published in STC's Intercom magazine ( http://www.stc.org/intercom/PDFs/2006/20067-8_14-17.pdf) for sending an e-mail message from a help topic to obtain feedback from users. I've followed the instructions for doing this, including adding the JavaScript file as a baggage file to the project, a script reference, and adding a link to call the script from the topic, but it doesn't work. When I test the link on the topic, I get an "Error on page" message. When I click the View this item icon in Robohelp, I get an Internet Explorer script error:

      An error has occurred in the script on this page
      Line: 5
      Char: 15
      Error: Invalid character
      Code: 0

      I have not written or debugged JavaScript before, just more or less cut and pasted existing scripts and changed variables, so I'm at a loss. Any idea what the problem is?

      Code appears below. Many thanks!


      Here's the script:

      function sendFeedback()
      var mailtoS = “mailto:<brett.peruzzi@pfpc.com>” +
      “&Subject=Documentation feedback:
      <test help file>” +
      “&Body=” + “Topic title:” + document
      .title +
      “%0ABrowser:” + clientInformation
      .appName +
      “%0AVersion:” + clientInformation
      .appVersion +
      window.open( mailtoS );

      Here's the script reference:

      <script type="text/javascript"

      And here's the link:

      <p CLASS=BodyText
      style="font-size: 9pt;
      font-weight: normal;
      font-style: normal;"><a href="javascript:sendFeedback()">Provide
      feedback on this help topic</a></p>

        • 1. Re: Sending an E-mail message from a Webhelp topic using JavaScript
          Captiv8r Adobe Community Professional & MVP
          Hi Brett

          I guess the link you provided only works if you are a dues paying STC member?

          Just at first glance here, I'm wondering if your line breaks are occurring at odd places. Sometimes this is more than enough to cause that nifty crunching sound as our scripts break.

          Hopefully others will offer up more, different or better insights here.

          Cheers... Rick
          • 2. Re: Sending an E-mail message from a Webhelp topic using JavaScript
            MergeThis Level 4
            You could try this one.

            Here's what's in my feedback_script.js file:

            var mailSubject = Subject Line Text';
            var mailBody = 'I have comments on this page: ' + location.href;
            var mailDisplay = '<img title= "Send us your comments." src="../../letter.gif" border=0>';
            '<a href="mailto:doc_address@domain'
            + '?subject=' + escape(mailSubject)
            + '&body=' + escape(mailBody)
            + '">' + mailDisplay + '</a>');

            letter.gif is at the root, two steps above, as is feedback_script.js. The call in each file is:

            <p span
            style="font-weight: normal; x-condition: Online;"><script src="../../feedback_script.js"
            type="text/javascript"></script> <!--kadov_tag{{<spaces>}}--> <span

            Good luck,

            • 3. Re: Sending an E-mail message from a Webhelp topic using JavaScript
              Roger N Level 2
              Brett, Rick, & Leon -

              I ran the script through its paces, and found that the STC newsletter typographers have done the misdeed. It doesn't show up here, but their sendFeedback() function is infested with typographic quotes, rather than ascii-compliant quotemarks.

              If you can't see them with your current editor, look at the file in Wordpad, and replace them there. A little typographic quote disinfectant, and it should work just fine.
              • 4. Re: Sending an E-mail message from a Webhelp topic using JavaScript
                wordguy Level 1
                Thanks for all of your help.

                I replaced the incorrect quotation marks (they didn't show up that way in Notepad, but did in Wordpad), but the script still didn't run. I changed the line breaks and it ran, but with somewhat incorrect results.

                All of the data appears in the To: field of the e-mail client (Notes 6.5 in my case), rather than also in the Subject and body fields.

                Sample results:

                <brett.peruzzi@pfpc.com>&Subject=Documentation feedback:<test help file>&Body=Topic title:Admin Site Log ReportBrowser:Microsoft Internet ExplorerVersion:4.0 (compatible; MSIE 6.0; Windows NT 5.0; PNCStd; InfoPath.1)Comments:

                Of course, a message that gets sent like this gets returned as undeliverable. Any idea how I can get the subject and body areas of the e-mail to populate correctly?

                Here's the revised script:

                function sendFeedback()
                var mailtoS="mailto:<brett.peruzzi@pfpc.com>" +
                "&Subject=Documentation feedback:<test help file>" +
                "&Body=" + "Topic title:" + document.title +
                "%0ABrowser:" + clientInformation.appName +
                "%0AVersion:" + clientInformation.appVersion +
                window.open( mailtoS );

                Thanks again,

                • 5. Re: Sending an E-mail message from a Webhelp topic using JavaScript
                  wordguy Level 1
                  Actually, just fixed it!

                  Showed the script to one of my developer friends here, and he recommended putting a ? after the mailto address, and that fixed it.